Knowledge Base

Cloudflare Header Examples

Cloudflare response header rules change what visitors receive. Keep those transformations separate from rules that control Cloudflare caching.

A small response-header rule

In your zone's Response Header Transform Rules, match the intended hostname and paths. For a site that does not already own these fields elsewhere, use:

  • Set static: X-Content-Type-Options = nosniff.
  • Set static: Referrer-Policy = strict-origin-when-cross-origin.

Set replaces an existing value or supplies a missing one. Add retains existing fields and may create duplicates. Choose the operation deliberately.

Cache rules have a different job

Changing Cache-Control with a response header transformation does not change the edge's earlier cache decision. Configure edge caching through Cache Rules or the appropriate supported origin-cache policy.

Do not make private account pages or session responses eligible for public caching just to improve a cache-hit indicator. Inspect status, request cookies, cache indicators, and the final public fields.

Check limitations and rule order

Some response fields are restricted; for example, the Server value cannot be freely modified through these rules. Removal deletes all instances of the selected field, so be especially careful around Set-Cookie.

Review other transformations and managed settings that affect the same fields. Cloudflare-generated error pages can also receive response transformations. Test representative HTML, assets, redirects, and errors through the public hostname.

Cloudflare is an optional example for sites using that service. It is not a dependency of ScanHeaders.com.

Technical sources

Copyright ©2026 MILAN INNOVATIONS LLC. All rights reserved.