Using Page Rules to Re-Write Host Headers

Customers can rewrite Host Headers using the Cloudflare Page Rules app. This feature is currently available for domains on the Enterprise plan.

A common use case for this functionality is when your content is hosted on an Amazon S3 bucket. Amazon has designed their system to only accept host headers that have the same name as the bucket hosting your content. In this way, a request to "Host:" must be re-written to “Host:", or else the request will be denied.

In some cases you can adjust your Amazon S3 Bucket to accept Host Headers that are not the bucket name.

To ensure the header is rewritten, go to Page Rules and specify the URL to match. Next, click Add a Setting and select Host Header Override, then enter the override value.

Now, Any request matching the URL you specified will have the host header overridden to the one you have put in the Host Header Override text box. See the example below:

Page Rules Host Header Override

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk