
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Wed, 15 Apr 2026 21:09:03 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Transform Rules:"Requests, Transform and Roll Out!"]]></title>
            <link>https://blog.cloudflare.com/transform-rules-requests-transform-and-roll-out/</link>
            <pubDate>Wed, 07 Jul 2021 12:59:42 GMT</pubDate>
            <description><![CDATA[ Perform URL Normalization, URL Rewriting, or Header Modification without having to write a line of code! ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3ms6u2WZoqyNjSMtDSszcO/af4c392d74ed61ee0c2b806e9a6e89dc/image10-2.png" />
            
            </figure><p>Applications expect specific inputs in order to perform optimally. Techniques used to shape inputs to meet an application's requirements might include <a href="https://developers.cloudflare.com/rules/normalization">normalizing the URLs</a> to conform to a consistent formatting standard, <a href="/introducing-transform-rules-with-url-rewriting-at-the-edge/">rewriting the URL’s</a> path and query based on different conditions and logic, and/or <a href="/transform-http-request-headers/">modifying headers</a> to indicate an application’s specific information. These are expensive to run and complex to manage. Cloudflare can help you to offload the heavy lifting of modifying requests for your servers with Transform Rules. In this blog we will cover the nuts and bolts of the functionality.</p><p>Origin server? : <i>Thank you so much for offloading that for me, Cloudflare</i></p><p>Cloudflare edge servers? : <i>No problem, buddy, I have taken care of that for you</i></p>
    <div>
      <h2>Why do people need Transform Rules?</h2>
      <a href="#why-do-people-need-transform-rules">
        
      </a>
    </div>
    <p>When it comes to modifying an HTTP/HTTPS request with normalization, rewriting the URLs, and/or modifying headers, Cloudflare users often use <a href="https://developers.cloudflare.com/workers/">Cloudflare Workers</a>, code they craft that runs on Cloudflare’s edge.</p><p>Cloudflare Workers open the door to many possibilities regarding the amount of work that can be done for your applications, close to where your end users are located. It provides a serverless execution environment that allows you to create application functionality without configuring or maintaining infrastructure. However, using a Worker to modify the request is kind of like wearing a diving suit in a kiddie pool. Therefore, a simple tool to modify requests without Workers has long been wanted.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/62P8ovhPVq9mJuMFjJcVSD/e8949a7092f6a362e32b51b5eb2b9e12/image13.png" />
            
            </figure><p>It’s in this context that we looked at the most common request modifications that customers were making, and built out Transform Rules to cover them. Once Transform Rules were announced we anticipated they’d become the favourite tool in our customers’ tool box.</p>
    <div>
      <h2>What do Transform Rules do?</h2>
      <a href="#what-do-transform-rules-do">
        
      </a>
    </div>
    <ul><li><p><b>URL Normalization:</b> normalizes HTTP requests to a standard format which then allows you to predictably write security rule filters.</p></li><li><p><b>URL Rewrite:</b> static and dynamic rewrites of the URL’s path and/or query string based on various attributes of the request.</p></li><li><p><b>Header Modify:</b> add or remove static or dynamic headers (based on Cloudflare specific attributes) to requests based on different various attributes of the request.</p></li></ul>
    <div>
      <h3>URL Normalization</h3>
      <a href="#url-normalization">
        
      </a>
    </div>
    <p>Bad actors on the Internet often encode your URLs to attack your applications because encoded URLs can bypass some security rules. URL Normalization transforms the request URL from encoded to unencoded before Cloudflare’s security features, so no one can bypass the firewall rules you configure.</p><p>For example, say you had a rate limiting rule for the path "<code>/login</code>" but someone sent the request as “<code>/%6cogin</code>”. Illustrated below:</p><p>You?: <i>Rate Limiting for </i><code><i>https://www.example.com/login</i></code><i> to avoid </i><a href="https://www.cloudflare.com/learning/bots/brute-force-attack/"><i>brute force attacks</i></a><i>.</i></p><p>Attacker?: <i>You think you can stop me? I will issue massive requests to </i><code><i>https://www.example.com/%6cogin</i></code><i> to bypass your rate limiting rule.</i></p><p>Without URL Normalization, the request would bypass the rate limiting rule, but with URL Normalization the request is converted from the URL path <code>/%6cogin</code> to <code>/login</code> before the rule is applied.</p><p>By default, URL Normalization is enabled for all the zones on Cloudflare at Cloudflare’s edge, and disabled when going to origins. This means incoming URLs will be decoded to standard format before any Cloudflare security execution. When going back to the origins, we will use the original URL. In this way, no encoded URL can bypass security features and the origin also can see the original URL.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1f33EIaG1UvCcCBNaLWwpi/d16c1eb4e8d125a5227d1180ebc7e7d0/image3-2.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/zUZWJPDIgV6U7KIw69BSE/d0cbfe19cfe045a96617b4a5c674c583/image1-5.png" />
            
            </figure><p>The default settings are flexible to adjust if you need. <a href="https://community.cloudflare.com/t/faq-url-normalization/259183">This FAQ page</a> has more information about URL Normalization.</p>
    <div>
      <h3>URL Rewrite</h3>
      <a href="#url-rewrite">
        
      </a>
    </div>
    <p>When talking about URL Rewrites, we always want to distinguish them from URL Redirects. They are like twins. Rewrites is a server-side modification of the URL before it is fully processed by the web server. This will not change what is seen in the user’s browser. Redirects forward URLs to other locations via a 301 or 302 HTTP status code. This will change what is seen in the user’s browser. You can do a URL Redirect with "Forwarding URL" in <a href="https://support.cloudflare.com/hc/en-us/articles/218411427">Cloudflare Pages Rules</a>. Page Rules trigger actions whenever a request matches one of the URL patterns you define_._</p><p>Transform Rules come into play when we need to use URL Rewrite. This allows you to rewrite a URL’s path and/or query string based on the logic of your applications. The rewrite can be a fixed string (which we call ‘static’) or a computed string (called ‘dynamic’) based on various attributes of a request, like the country it came from, the referrer, or parts of the path. These rewrites come before products such as Firewall Rules, Page Rules, and Cloudflare Workers.</p>
    <div>
      <h3>Static URL Rewrite Example</h3>
      <a href="#static-url-rewrite-example">
        
      </a>
    </div>
    <p>When visiting <code>www.example.com</code> with a cookie of <code>version=v1</code>, you want to rewrite the URL to <code>www.example.com/v1</code> when going to the origin server. In this case, the end-user facing URL will not change, but the content will be the /v1’s content. This is a static URL rewrite. It only does rewrites when end users visit the URL <code>www.example.com</code> with cookie <code>version=v1</code><i>.</i> It can help you to do A/B testing when rolling out new content.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6xbvwaBlCv7apqIU45AdTU/1f8ea0e9d0e76537f04feefea6d5966f/image9-1.png" />
            
            </figure>
    <div>
      <h3>Dynamic URL Rewrite Example</h3>
      <a href="#dynamic-url-rewrite-example">
        
      </a>
    </div>
    <p>When visiting any URL of <code>www.example.com</code> with a cookie of <code>version=v1</code>, you want to rewrite the request by adding <code>/v1/</code> to the beginning of the URL for v1 content, when going to the origin server.</p><p>In this use case, when end users visit <code>www.example.com/Literaturelibrary/book1314</code> with cookie <code>version=v1</code>, Cloudflare will rewrite the URL to <code>www.example.com/v1/Literaturelibrary/book1314</code>.</p><p>When end users visit <code>www.example.com/fictionlibrary/book52/line43/universe</code> with cookie <code>version=v1</code>, Cloudflare will rewrite the URL to <code>www.example.com/v1/fictionlibrary/book52/line43/universe</code>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5VX3SJrAzXtXQDx9r99Ol7/7994f0b6e4c43148a2567b4c8c165edb/image2-3.png" />
            
            </figure><p>In this case, the URL visible in the client’s browser will not change, but the content returned will be from the <code>/v1</code> location. This is a dynamic URL rewrite, so it applies the rewrite to all URLs when end users visit with the cookie.</p>
    <div>
      <h3>Another Dynamic URL Rewrite Example</h3>
      <a href="#another-dynamic-url-rewrite-example">
        
      </a>
    </div>
    <p>When visiting any URL of <code>www.example.com</code> with a cookie of <code>version=v1</code> and query string of <code>page=1</code> that has <code>/global</code> in the beginning of the URL, this rule rewrites the request by replacing <code>/global</code> in the beginning for the URL with <code>/v1</code> and updates the query string to <code>newpage=1</code>, when going to the origin server.</p><p>When end users visit <code>www.example.com/global/Literaturelibarary/book1013?page=1</code> with cookie of <code>version=v1</code><b>,</b> Cloudflare will rewrite the URL to <code>www.example.com/v1/Literaturelibarary/book1013?newpage=1</code>.</p><p>And when end users visit <code>www.example.com/global/fictionlibarary/book52/line43/universe?page=1</code> with cookie of <code>version=v1</code><b>,</b> Cloudflare will rewrite the URL to <code>www.example.com/v1/fictionlibarary/book52/line43/universe?newpage=1</code>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5z21p3m7Bt3vAcqRMXuAHc/6730cd6d20ffd8904b89d55f741febc0/image6-3.png" />
            
            </figure><p>In this case, the end-user facing URLs will not change, but the content will be v1’s content. This is a dynamic URL rewrite, so it applies the rewrite to all URLs when end users visit with the cookie of <code>version=v1</code> and a query string of <code>page=1</code>.</p>
    <div>
      <h3>Header Modify</h3>
      <a href="#header-modify">
        
      </a>
    </div>
    <p>Adding/removing request headers of the requests when going to origin servers. This is one of the most requested features of customers using Cloudflare Workers, especially those sending the Bot Score as a request header to origin. <a href="/transform-http-request-headers/">You can use this feature</a> to add/remove strings and non-strings, and static or dynamic request header values.</p><p><b>Set Static header:</b> Adds a static header and value to the request and sends it to the origin.</p><p>For example, add a request header such as <code>foo: bar</code> only when the requests have the hostname of <code>www.example.com</code>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1u2KfCcl08HmV4vGuMp6Tq/25cb7038fb5bac3b804d905f70addeb9/pasted-image-0.png" />
            
            </figure><p>With the above setting, Cloudflare appends a static header Foo: bar to your origin when this rule triggers. Here is what the origin should see.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3GP9tyY2bKuneIOCqvrox7/daed985ba5d99ef49ade7e636932f933/image8-1.png" />
            
            </figure><p><b>Set Dynamic header :</b> Adds a dynamic header value from the computed field, like the end user’s geolocation.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/zfVWPAG1OBr2jyHmPxpQi/f475e986ca8675e038b790bfd572970a/image7-1.png" />
            
            </figure><p>The dynamic request headers are added.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5ZT19vARgXTzSCAnzmpSG9/728bd7100c2c7f2f419c0afca9048f80/image5-4.png" />
            
            </figure><p><b>Set Dynamic Bot Management headers:</b> Cloudflare Bot Management protects applications from bad bot traffic by scoring each request with a “bot score” from 1 to 99. With Bot Management enabled, we can send the bot score to the origin server as a request header via Transform Rules.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2fAWqLlHhQnTbvhbhLkHR8/02dbfda7d1688295a600bbf58570eba3/image4-2.png" />
            
            </figure><p>The bot score header is added.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2RVr7yI1GAKQLRX0h2YBR6/36defb26432dd7fc9f3b463ceac6d74e/image12.png" />
            
            </figure>
    <div>
      <h2>It has never been easier</h2>
      <a href="#it-has-never-been-easier">
        
      </a>
    </div>
    <p>With Transform Rules, you can modify the request with URL Normalization, URL Rewrites, and HTTP Header Modification with easy settings to power your application. There’s no script required for Cloudflare to offload those duties from your origin servers. Just like Optimus Prime says “Autobots, transform and roll out!", Cloudflare says “Requests, transform and roll out!”.</p><p>Try out the latest <a href="https://dash.cloudflare.com/">Transform Rules</a> yourself today.</p> ]]></content:encoded>
            <category><![CDATA[Transform Rules]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Edge Rules]]></category>
            <guid isPermaLink="false">3vVQWmA3jPNtZKtu9VcOq8</guid>
            <dc:creator>Ming Xue</dc:creator>
        </item>
    </channel>
</rss>