To override the Host header set to Amazon S3 for a single backend, you would normally use the hostname of your S3 bucket when you specify the default host for a service. To use a different Host header for a non-S3 backend within the same service, however, you should perform the Host overwrite using a new Header in the Default Settings and then you should specify a new request condition to set that header appropriately.
Log in to the Fastly application and click the configure tab to access the control panel.
Select the appropriate service from the Service menu.
Click the blue Configure button to the right of the service name.
Click the Content pane from the list on the left.
In the Headers area, click the New button to create a new header. The New Header window appears.
Fill out the New Header window as follows:
- In the Name field, type S3_Host_Rewrite.
- From the Type menu select Request and from the Action menu, select Set.
- In the Destination field, type http.Host.
- In the Source field, type “.s3.amazonaws.com”.
- From the Ignore if Set menu, select No.
- In the Priority field, type 10.
Click the Create button. A new header appears in the Headers area of the Content section.
Click the gear icon next to the name of the header you just created and select Conditions. The Choose Conditions window appears.
Click the New button to create a new condition. The New Condition window appears.
Fill out the New Condition window as follows:
- In the Name field, type S3_Host_Rewrite_Condition.
- In the Apply if field type req.http.Host == “images.fee.bar”.
- Click Activate to deploy your changes.
Please sign in to leave a comment.