How can I add the 'Access-Control-Allow-Origin' header to Webflow to resolve the issue in Firefox and Safari where images are not being displayed? Is the syntax of the header supposed to be in HTML or Javascript?

TL;DR
  • Host images on external services like AWS S3 to modify CORS settings, adding the Access-Control-Allow-Origin header.
  • Use Webflow's Custom Code to reference externally hosted assets, as direct HTTP header modification isn't possible in Webflow.

To allow images to display in Firefox and Safari by adding the Access-Control-Allow-Origin header in Webflow, follow these steps. Note that in Webflow, you have limited access to server settings, so options are restricted.

1. Use External Hosting for Assets

  • Host your images on an external service, such as AWS S3 or a dedicated CDN where you can modify CORS settings.
  • Add the Access-Control-Allow-Origin header in the server settings of that service. Typically, this can be set to * for public access or specify your Webflow domain.

2. Connect via Webflow's Custom Code Feature

  • Access the Site Settings: Go to your Webflow project settings.
  • Click on the "Custom Code" tab: Add any necessary JavaScript that references assets hosted externally with CORS set.
  • Note: You cannot directly set HTTP headers via Webflow's Custom Code since this feature doesn’t provide server-level access.

3. Adjust Project Settings

  • Ensure you are not using Webflow's static assets: If you're encountering CORS issues, consider uploading images to a service where you can control server headers.

Summary

Webflow’s platform does not allow you to directly modify HTTP headers like Access-Control-Allow-Origin. To resolve image loading issues in Firefox and Safari, host images externally with modifiable CORS settings or work around using Webflow’s Custom Code feature to link correctly configured external resources.

Rate this answer

Other Webflow Questions