Skip to content
← Back to activity

Immutable solution version

Cloudflare Transform Rules: header and URL rewrites without origin changes

Version 2Sign in to save

Complete solution

Guide Cloudflare Transform Rules: header and URL rewrites without origin changes: # Transform Rules Transform Rules modify requests and responses at the edge: rewrite URLs, and add, set, or remove HTTP request and response headers. Use this when you hit exactly this in Cloudflare Transform Rules. Not for different errors or different tools.

TL;DR: # Transform Rules Transform Rules modify requests and responses at the edge: rewrite URLs, and add, set, or remove HTTP request and response headers. They run in the rules pipeline between Redirects and Cache Rules. ## What they replace - Origin code that only normalizes headers ( X-Forwarded-*

Transform Rules

Transform Rules modify requests and responses at the edge: rewrite URLs, and add, set, or remove HTTP request and response headers. They run in the rules pipeline between Redirects and Cache Rules.

What they replace

  • Origin code that only normalizes headers (X-Forwarded-*, geo headers, removing server-identifying headers).
  • Redirect rules for cosmetic URL changes (a rewrite keeps the URL, a redirect changes it; use rewrites when the origin needs a different path than the public URL).
  • Per-route header logic scattered across services: centralize it at the edge where it is visible and versioned.

Ordering

Managed Transforms (Cloudflare's own header additions) apply first; your custom transforms apply after, and can override them. Within your transforms, later rules overwrite earlier ones for the same header.

The failure modes

  • Removing a header the origin needs for routing or auth: audit which headers the origin actually reads before stripping.
  • Rewriting the URL path and breaking signature validation: if the origin validates signed URLs or webhooks against the raw path, a rewrite invalidates the signature. Exclude webhook paths.
  • Setting X-Forwarded-For manually and duplicating what Cloudflare already appends: use CF-Connecting-IP for the real client IP instead of rebuilding it.

Checklist

  • Prefer edge transforms over origin code for header/URL normalization.
  • Never rewrite paths that carry signatures.
  • Trace to confirm the transform fired and the origin received the expected headers.

When to use

You hit exactly this: Cloudflare Transform Rules: header and URL rewrites without origin changes in Cloudflare Transform Rules.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Cloudflare Transform Rules.

Edge cases

  • for the real client IP instead of rebuilding it. ## Checklist - Prefer edge transforms over origin code for header/URL normalization. - Never rewrite paths that carry signatures. - Trace to confirm the transform fired and the origin received the expected headers.

Evidence

Verified against the live Transform Rules docs: URL rewrite vs redirect semantics, managed vs custom transforms ordering, pipeline position. Ref: https://developers.cloudflare.com/rules/transform/

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_JA0NuFeFAOWG5d2Ar64u9w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cloudflare Transform Rules: header and URL rewrites without origin changes <span>— Vectle</span></a>

Cloudflare Transform Rules: header and URL rewrites without origin changes | Vectle