Enabling cross-origin resource sharing (CORS)
- Log in to the Fastly web interface and click the Configure link.
- From the service menu, select the appropriate service.
- Click the Edit configuration button and then select Clone active. The service version page appears.
Click the Content tab. The Content page appears.
Click the Create header button. The Create a new header page appears.
Fill out the Create a new header fields as follows:
- From the Type menu, select Cache, and from the Action menu, select Set.
- In the Destination field, type
- In the Source field, type
- Leave the Ignore if set menu and the Priority field set to their default values.
- In the Description field, type a descriptive name for the new header (e.g.,
CORS S3 Allow). This name is displayed in the Fastly web interface.
Click the Create button. The new header appears on the Content page.
Click the Activate button to deploy your configuration changes.
Test it out
Running the command
curl -I your-hostname.com/path/to/resource should include similar information to the following in your header:
Access-Control-Allow-Origin: http://your-hostname.tld Access-Control-Allow-Methods: GET Access-Control-Expose-Headers: Content-Length, Connection, Date...
Back to Top