
<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 08:50:25 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Cloudflare Snippets are now Generally Available]]></title>
            <link>https://blog.cloudflare.com/snippets/</link>
            <pubDate>Wed, 09 Apr 2025 14:00:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare Snippets are now generally available, enabling fast, cost-free JavaScript-based HTTP traffic modifications across all paid plans.  ]]></description>
            <content:encoded><![CDATA[ 
    <div>
      <h2>Program your traffic at the edge — fast, flexible, and free</h2>
      <a href="#program-your-traffic-at-the-edge-fast-flexible-and-free">
        
      </a>
    </div>
    <p><a href="https://developers.cloudflare.com/rules/snippets/"><u>Cloudflare Snippets</u></a> are <b>now generally available (GA)</b> for all paid plans, giving you a fast, flexible way to control HTTP traffic using lightweight JavaScript “code rules” — at no extra cost.</p><p>Need to transform headers dynamically, fine-tune <a href="https://www.cloudflare.com/learning/cdn/what-is-caching/">caching</a>, rewrite URLs, retry failed requests, replace expired links, throttle suspicious traffic, or validate authentication tokens? Snippets provide a production-ready solution built for performance, security, and control.</p><p>With GA, we’re introducing a new <a href="https://developers.cloudflare.com/changelog/2025-01-29-snippets-code-editor/"><u>code editor</u></a> to streamline writing and testing logic. This summer, we’re also rolling out an integration with <a href="https://blog.cloudflare.com/secrets-store-beta/"><u>Secrets Store</u></a> — enabling you to bind and manage sensitive values like API keys directly in Snippets, securely and at scale.</p>
    <div>
      <h2>What are Snippets?</h2>
      <a href="#what-are-snippets">
        
      </a>
    </div>
    <p>Snippets bring the power of JavaScript to <a href="https://developers.cloudflare.com/rules/"><u>Cloudflare Rules</u></a>, letting you write logic that runs before a request reaches your origin or after a response returns from upstream. They’re ideal when built-in rule actions aren’t quite enough. While Cloudflare Rules let you define traffic logic without code, Snippets extend that model with greater flexibility for advanced scenarios.</p><p>Think of Snippets as the ultra-fast <b>“code layer” </b>of <a href="https://developers.cloudflare.com/rules/"><u>Cloudflare Rules</u></a>: the <a href="https://developers.cloudflare.com/ruleset-engine/"><u>Ruleset Engine</u></a> evaluates your rules and invokes your code, which then runs on the <a href="https://developers.cloudflare.com/workers/runtime-apis/"><u>Workers runtime</u></a>.</p>
    <div>
      <h3>Key capabilities of Snippets:</h3>
      <a href="#key-capabilities-of-snippets">
        
      </a>
    </div>
    <ul><li><p><b>Ultra-fast execution</b>: optimized for speed with the <a href="https://developers.cloudflare.com/ruleset-engine/"><u>Ruleset Engine</u></a> and <a href="https://developers.cloudflare.com/workers/runtime-apis/"><u>Workers runtime</u></a>.</p></li><li><p><b>Granular request matching</b>: trigger Snippets based on <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/http.request.full_uri/"><u>URI</u></a>, <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/http.user_agent/"><u>user-agent</u></a>, <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/http.request.cookies/"><u>cookies</u></a>, headers and more.</p></li><li><p><b>Sequential execution</b>: <a href="https://developers.cloudflare.com/rules/snippets/how-it-works/"><u>run</u></a> multiple Snippets on the same request, applying modifications step by step.</p></li><li><p>Native <a href="https://developers.cloudflare.com/rules/"><u>Cloudflare Rules</u></a> integration: Snippets <a href="https://developers.cloudflare.com/ruleset-engine/reference/phases-list/#request-phases"><u>inherit</u></a> request modifications from other Cloudflare products.</p></li><li><p>JavaScript and Web APIs support, plus essential <a href="https://developers.cloudflare.com/workers/runtime-apis/"><u>Workers runtime</u></a> features:</p><ul><li><p><a href="https://developers.cloudflare.com/workers/runtime-apis/fetch/"><u>fetch API</u></a></p></li><li><p><a href="https://developers.cloudflare.com/workers/runtime-apis/cache/"><u>cache API</u></a></p></li><li><p><a href="https://developers.cloudflare.com/workers/runtime-apis/request/#incomingrequestcfproperties"><u>request.cf object</u></a></p></li><li><p><a href="https://developers.cloudflare.com/workers/runtime-apis/html-rewriter/"><u>HTMLRewriter</u></a></p></li></ul></li><li><p>Automated deployment and versioning via <a href="https://developers.cloudflare.com/rules/snippets/create-terraform/"><u>Terraform</u></a>.</p></li></ul><p>Best of all? Snippets are <a href="https://developers.cloudflare.com/rules/snippets/#availability"><u>included</u></a> at no extra cost for Pro, Business, and Enterprise plans — with <b>no usage-based fees</b>.</p>
    <div>
      <h2>The journey to GA: How Snippets became production-grade</h2>
      <a href="#the-journey-to-ga-how-snippets-became-production-grade">
        
      </a>
    </div>
    <p>Cloudflare Snippets started as a bold idea: bring the power of JavaScript-based logic to Cloudflare Rules, without the complexity of a full-stack developer platform.</p><p>Over the past two years, Snippets have evolved into a production-ready “code rules” solution, shaping the future of HTTP traffic control.</p><p><b>2022:</b> Cloudflare Snippets were <a href="https://blog.cloudflare.com/snippets-announcement/"><u>announced</u></a> during Developer Week as a solution for users needing flexible HTTP traffic modifications without a full Worker.</p><p><b>2023:</b> <b>Alpha launch </b>— hundreds of users tested Snippets for high-performance traffic logic.</p><p><b>2024:</b> <b>7x traffic growth</b>, processing 17,000 requests per second. Terraform support and production-grade backend were released.</p><p><b>2025:</b> <b>General Availability </b>— Snippets introduces a <a href="https://developers.cloudflare.com/changelog/2025-01-29-snippets-code-editor/"><u>new code editor</u></a>, <a href="https://developers.cloudflare.com/changelog/2025-02-12-rules-upgraded-limits/"><u>increased limits</u></a> alongside other Cloudflare Rules products, integration with <a href="https://developers.cloudflare.com/fundamentals/trace-request/#_top"><u>Trace</u></a>, and a production-grade experience built for scale, handling <b>over 2 million requests per second</b> at peak. Integration with the Secrets Store is rolling out this summer.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1fZv7cpSGntSQadS761Zkv/31707075a85d393f4883b190599581f7/1.png" />
          </figure>
    <div>
      <h2>New: Snippets + Trace</h2>
      <a href="#new-snippets-trace">
        
      </a>
    </div>
    <p><a href="https://developers.cloudflare.com/fundamentals/trace-request/#_top"><u>Cloudflare Trace</u></a> now shows exactly which Snippets were triggered on a request. This makes it easier to debug traffic behavior, verify logic execution, and understand how your Snippets interact with other products in the request pipeline.</p><p>Whether you’re fine-tuning header logic or troubleshooting a routing issue, Trace gives you real-time insight into how your edge logic behaves in production.</p><div>
  
</div>
<p></p>
    <div>
      <h2>Coming soon: Snippets + Secrets Store</h2>
      <a href="#coming-soon-snippets-secrets-store">
        
      </a>
    </div>
    <p>In the third quarter, you’ll be able to securely access API keys, authentication tokens, and other sensitive values from <a href="https://blog.cloudflare.com/secrets-store-beta/"><u>Secrets Store</u></a> directly in your Snippets. No more plaintext secrets in your code, no more workarounds.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/51QyhWrvtGEQ568lzuqRD/f8eb60c0258d28ef1431fad7f5d03b12/2.png" />
          </figure><p>Once rolled out, secrets can be configured for Snippets via the <a href="https://developers.cloudflare.com/rules/snippets/create-dashboard/"><u>dashboard</u></a> or <a href="https://developers.cloudflare.com/rules/snippets/create-api/"><u>API</u></a> under the new <b>“Settings”</b> button.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2ipprc9qz2mPpp7XGOURgH/47112dde677906746ef4f798d5c082c0/3.png" />
          </figure>
    <div>
      <h2>When to use Snippets vs. Cloudflare Workers</h2>
      <a href="#when-to-use-snippets-vs-cloudflare-workers">
        
      </a>
    </div>
    <p>Snippets are fast, flexible, and free, but how do they compare to Cloudflare Workers? Both allow you to programmatically control traffic. However, they solve different problems:</p><div>
    <figure>
        <table>
            <colgroup>
                <col></col>
                <col></col>
                <col></col>
            </colgroup>
            <tbody>
                <tr>
                    <td>
                        <p><span><span><strong>Feature</strong></span></span></p>
                    </td>
                    <td>
                        <p><span><span><strong>Snippets</strong></span></span></p>
                    </td>
                    <td>
                        <p><span><span><strong>Workers</strong></span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Execute scripts based on request attributes (headers, geolocation, cookies, etc.)</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                    <td>
                        <p><span><span>❌</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Modify HTTP requests/responses or serve a different response</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Add, remove, or rewrite headers dynamically</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Cache</span></span><span><span> assets at the edge</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Route traffic dynamically between origins</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Authenticate</span></span><span><span> requests, pre-sign URLs, run A/B testing</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Perform compute-intensive tasks (e.g., AI inference, image processing)</span></span></p>
                    </td>
                    <td>
                        <p><span><span>❌</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Store persistent data (e.g., KV, Durable Objects, D1)</span></span></p>
                    </td>
                    <td>
                        <p><span><span>❌</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Deploy via CLI (Wrangler)</span></span></p>
                    </td>
                    <td>
                        <p><span><span>❌</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p><span><span>Use TypeScript, Python, Rust or other programming languages</span></span></p>
                    </td>
                    <td>
                        <p><span><span>❌</span></span></p>
                    </td>
                    <td>
                        <p><span><span>✅</span></span></p>
                    </td>
                </tr>
            </tbody>
        </table>
    </figure>
</div><p><b>Use Snippets when:</b></p><ul><li><p>You need ultra-fast conditional traffic modifications directly on Cloudflare’s network.</p></li><li><p>You want to extend Cloudflare Rules beyond built-in actions.</p></li><li><p>You need free, unlimited invocations within the <a href="https://developers.cloudflare.com/rules/snippets/#limits"><u>execution limits</u></a>.</p></li><li><p>You are migrating from VCL, Akamai’s EdgeWorkers, or on-premise logic.</p></li></ul><p><b>Use Workers when:</b></p><ul><li><p>Your application requires state management, Developer Platform product integrations, or high compute limits.</p></li><li><p>You are building APIs, full-stack applications, or complex workflows.</p></li><li><p>You need logging, debugging tools, CLI support, and gradual rollouts.</p></li></ul><p>Still unsure? Check out our <a href="https://developers.cloudflare.com/rules/snippets/when-to-use/"><u>detailed guide</u></a> for best practices.</p>
    <div>
      <h2>Snippets in action: real-world use cases</h2>
      <a href="#snippets-in-action-real-world-use-cases">
        
      </a>
    </div>
    <p>Below are practical use cases demonstrating Snippets. Each script can be dynamically triggered using our powerful <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/"><u>Rules</u></a> language, so you can granularly control which requests your Snippets will be applied to.</p>
    <div>
      <h3>1. Dynamically modify headers</h3>
      <a href="#1-dynamically-modify-headers">
        
      </a>
    </div>
    <p>Inject custom headers, remove unnecessary ones, and tweak values on the fly:</p>
            <pre><code>export default {
  async fetch(request) {
    const timestamp = Date.now().toString(16); // convert timestamp to HEX
    const modifiedRequest = new Request(request, { headers: new Headers(request.headers) });
    modifiedRequest.headers.set("X-Hex-Timestamp", timestamp); // send HEX timestamp to upstream

    const response = await fetch(modifiedRequest);
    const newResponse = new Response(response.body, response); // make response from upstream mutable

    newResponse.headers.append("x-snippets-hello", "Hello from Cloudflare Snippets"); // add new response header
    newResponse.headers.delete("x-header-to-delete"); // delete response header
    newResponse.headers.set("x-header-to-change", "NewValue"); // replace the value of existing response header

    return newResponse;
  },
};</code></pre>
            
    <div>
      <h3>2. Serve a custom maintenance page</h3>
      <a href="#2-serve-a-custom-maintenance-page">
        
      </a>
    </div>
    <p>Route traffic to a maintenance page when your origin is undergoing planned maintenance:</p>
            <pre><code>export default {
    async fetch(request) { // for all matching requests, return predefined HTML response with 503 status code
        return new Response(`
            &lt;!DOCTYPE html&gt;
            &lt;html lang="en"&gt;
            &lt;head&gt;
                &lt;meta charset="UTF-8"&gt;
                &lt;title&gt;We'll Be Right Back!&lt;/title&gt;
                &lt;style&gt; body { font-family: Arial, sans-serif; text-align: center; padding: 20px; } &lt;/style&gt;
            &lt;/head&gt;
            &lt;body&gt;
                &lt;h1&gt;We'll Be Right Back!&lt;/h1&gt;
                &lt;p&gt;Our site is undergoing maintenance. Check back soon!&lt;/p&gt;
            &lt;/body&gt;
            &lt;/html&gt;
        `, { status: 503, headers: { "Content-Type": "text/html" } });
    }
};</code></pre>
            
    <div>
      <h3>3. Retry failed requests to a backup origin</h3>
      <a href="#3-retry-failed-requests-to-a-backup-origin">
        
      </a>
    </div>
    <p>Ensure reliability by automatically rerouting requests when your primary origin returns an unexpected response:</p>
            <pre><code>export default {
  async fetch(request) {
    const response = await fetch(request); // send original request to the origin

    if (!response.ok &amp;&amp; !response.redirected) { // if response is not 200 OK or a redirect, send to another origin
      const newRequest = new Request(request); // clone the original request to construct a new request
      newRequest.headers.set("X-Rerouted", "1"); // add a header to identify a re-routed request at the new origin
      const url = new URL(request.url); // clone the original URL
      url.hostname = "backup.example.com"; // send request to a different origin / hostname
      return await fetch(url, newRequest); // serve response from the backup origin
    }

    return response; // otherwise, serve response from the primary origin
  },
};</code></pre>
            
    <div>
      <h3>4. Redirect users based on their location</h3>
      <a href="#4-redirect-users-based-on-their-location">
        
      </a>
    </div>
    <p>Send visitors to region-specific sites for better localization:</p>
            <pre><code>export default {
    async fetch(request) {
        const country = request.cf.country; // identify visitor's country using request.cf property
        const redirectMap = { US: "https://example.com/us", EU: "https://example.com/eu" }; // define redirects for each country
        if (redirectMap[country]) return Response.redirect(redirectMap[country], 301); // redirect on match
        return fetch(request); // otherwise, proceed to upstream normally
    }
};</code></pre>
            
    <div>
      <h2>Getting started with Snippets</h2>
      <a href="#getting-started-with-snippets">
        
      </a>
    </div>
    <p>Snippets are available right now in the Cloudflare dashboard under <b>Rules &gt; Snippets</b>:</p><ol><li><p>Go to Rules → Snippets.</p></li><li><p>Use prebuilt <a href="https://developers.cloudflare.com/rules/examples/"><u>templates</u></a> or write your own JavaScript code.</p></li><li><p>Configure a flexible rule to trigger your Snippet.</p></li><li><p>Test and deploy instantly.</p></li><li><p>Automate via <a href="https://developers.cloudflare.com/rules/snippets/create-api/"><u>API</u></a> or <a href="https://developers.cloudflare.com/rules/snippets/create-terraform/"><u>Terraform</u></a>.</p></li></ol>
    <div>
      <h2>Try Snippets today</h2>
      <a href="#try-snippets-today">
        
      </a>
    </div>
    <p>Cloudflare Snippets are now generally available, bringing fast, cost-free, and intelligent HTTP traffic control to all paid plans.</p><p>With native integration into Cloudflare Rules and Terraform — and Secrets Store integration coming this summer — Snippets provide the most efficient way to manage advanced traffic logic at scale.</p><p>Explore Snippets in the Cloudflare Dashboard and start optimizing your traffic with lightweight, flexible rules that enhance performance and reduce complexity.</p> ]]></content:encoded>
            <category><![CDATA[Developer Week]]></category>
            <category><![CDATA[Snippets]]></category>
            <category><![CDATA[General Availability]]></category>
            <category><![CDATA[JavaScript]]></category>
            <category><![CDATA[CDN]]></category>
            <category><![CDATA[Edge Rules]]></category>
            <category><![CDATA[Developers]]></category>
            <guid isPermaLink="false">6rBnmM6UiFX8ca7XXlOU2X</guid>
            <dc:creator>Nikita Cano</dc:creator>
        </item>
        <item>
            <title><![CDATA[Improved Bot Management flexibility and visibility with new high-precision heuristics]]></title>
            <link>https://blog.cloudflare.com/bots-heuristics/</link>
            <pubDate>Wed, 19 Mar 2025 13:00:00 GMT</pubDate>
            <description><![CDATA[ By building and integrating a new heuristics framework into the Cloudflare Ruleset Engine, we now have a more flexible system to write rules and deploy new releases rapidly. ]]></description>
            <content:encoded><![CDATA[ <p>Within the Cloudflare Application Security team, every <a href="https://www.cloudflare.com/learning/ai/what-is-machine-learning/"><u>machine learning</u></a> model we use is underpinned by a rich set of static rules that serve as a ground truth and a baseline comparison for how our models are performing. These are called heuristics. Our Bot Management heuristics engine has served as an important part of eight global <a href="https://developers.cloudflare.com/bots/concepts/bot-score/#machine-learning"><u>machine learning (ML) models</u></a>, but we needed a more expressive engine to increase our accuracy. In this post, we’ll review how we solved this by moving our heuristics to the Cloudflare <a href="https://developers.cloudflare.com/ruleset-engine/"><u>Ruleset Engine</u></a>. Not only did this provide the platform we needed to write more nuanced rules, it made our platform simpler and safer, and provided <a href="https://www.cloudflare.com/application-services/products/bot-management/"><u>Bot Management</u></a> customers more flexibility and visibility into their bot traffic.   </p>
    <div>
      <h3>Bot detection via simple heuristics</h3>
      <a href="#bot-detection-via-simple-heuristics">
        
      </a>
    </div>
    <p>In Cloudflare’s bot detection, we build heuristics from attributes like software library fingerprints, HTTP request characteristics, and internal threat intelligence. Heuristics serve three separate purposes for bot detection: </p><ol><li><p>Bot identification: If traffic matches a heuristic, we can identify the traffic as definitely automated traffic (with a <a href="https://developers.cloudflare.com/bots/concepts/bot-score/"><u>bot score</u></a> of 1) without the need of a machine learning model. </p></li><li><p>Train ML models: When traffic matches our heuristics, we create labelled datasets of bot traffic to train new models. We’ll use many different sources of labelled bot traffic to train a new model, but our heuristics datasets are one of the highest confidence datasets available to us.   </p></li><li><p>Validate models: We benchmark any new model candidate’s performance against our heuristic detections (among many other checks) to make sure it meets a required level of accuracy.</p></li></ol><p>While the existing heuristics engine has worked very well for us, as bots evolved we needed the flexibility to write increasingly complex rules. Unfortunately, such rules were not easily supported in the old engine. Customers have also been asking for more details about which specific heuristic caught a request, and for the flexibility to enforce different policies per heuristic ID.  We found that by building a new heuristics framework integrated into the Cloudflare Ruleset Engine, we could build a more flexible system to write rules and give Bot Management customers the granular explainability and control they were asking for. </p>
    <div>
      <h3>The need for more efficient, precise rules</h3>
      <a href="#the-need-for-more-efficient-precise-rules">
        
      </a>
    </div>
    <p>In our previous heuristics engine, we wrote rules in <a href="https://www.lua.org/"><u>Lua</u></a> as part of our <a href="https://openresty.org/"><u>openresty</u></a>-based reverse proxy. The Lua-based engine was limited to a very small number of characteristics in a rule because of the high engineering cost we observed with adding more complexity.</p><p>With Lua, we would write fairly simple logic to match on specific characteristics of a request (i.e. user agent). Creating new heuristics of an existing class was fairly straight forward. All we’d need to do is define another instance of the existing class in our database. However, if we observed malicious traffic that required more than two characteristics (as a simple example, user-agent and <a href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)"><u>ASN</u></a>) to identify, we’d need to create bespoke logic for detections. Because our Lua heuristics engine was bundled with the code that ran ML models and other important logic, all changes had to go through the same review and release process. If we identified malicious traffic that needed a new heuristic class, and we were also blocked by pending changes in the codebase, we’d be forced to either wait or rollback the changes. If we’re writing a new rule for an “under attack” scenario, every extra minute it takes to deploy a new rule can mean an unacceptable impact to our customer’s business. </p><p>More critical than time to deploy is the complexity that the heuristics engine supports. The old heuristics engine only supported using specific request attributes when creating a new rule. As bots became more sophisticated, we found we had to reject an increasing number of new heuristic candidates because we weren’t able to write precise enough rules. For example, we found a <a href="https://go.dev/"><u>Golang</u></a> TLS fingerprint frequently used by bots and by a small number of corporate VPNs. We couldn’t block the bots without also stopping the legitimate VPN usage as well, because the old heuristics platform lacked the flexibility to quickly compile sufficiently nuanced rules. Luckily, we already had the perfect solution with Cloudflare Ruleset Engine. </p>
    <div>
      <h3>Our new heuristics engine</h3>
      <a href="#our-new-heuristics-engine">
        
      </a>
    </div>
    <p>The Ruleset Engine is familiar to anyone who has written a WAF rule, Load Balancing rule, or Transform rule, <a href="https://blog.cloudflare.com/announcing-firewall-rules/"><u>just to name a few</u></a>. For Bot Management, the Wireshark-inspired syntax allows us to quickly write heuristics with much greater flexibility to vastly improve accuracy. We can write a rule in <a href="https://yaml.org/"><u>YAML</u></a> that includes arbitrary sub-conditions and inherit the same framework the WAF team uses to both ensure any new rule undergoes a rigorous testing process with the ability to rapidly release new rules to stop attacks in real-time. </p><p>Writing heuristics on the Cloudflare Ruleset Engine allows our engineers and analysts to write new rules in an easy to understand YAML syntax. This is critical to supporting a rapid response in under attack scenarios, especially as we support greater rule complexity. Here’s a simple rule using the new engine, to detect empty user-agents restricted to a specific JA4 fingerprint (right), compared to the empty user-agent detection in the old Lua based system (left): </p><table><tr><td><p><b>Old</b></p></td><td><p><b>New</b></p></td></tr><tr><td><p><code>local _M = {}</code></p><p><code>local EmptyUserAgentHeuristic = {</code></p><p><code>   heuristic = {},</code></p><p><code>}</code></p><p><code>EmptyUserAgentHeuristic.__index = EmptyUserAgentHeuristic</code></p><p><code>--- Creates and returns empty user agent heuristic</code></p><p><code>-- @param params table contains parameters injected into EmptyUserAgentHeuristic</code></p><p><code>-- @return EmptyUserAgentHeuristic table</code></p><p><code>function _M.new(params)</code></p><p><code>   return setmetatable(params, EmptyUserAgentHeuristic)</code></p><p><code>end</code></p><p><code>--- Adds heuristic to be used for inference in `detect` method</code></p><p><code>-- @param heuristic schema.Heuristic table</code></p><p><code>function EmptyUserAgentHeuristic:add(heuristic)</code></p><p><code>   self.heuristic = heuristic</code></p><p><code>end</code></p><p><code>--- Detect runs empty user agent heuristic detection</code></p><p><code>-- @param ctx context of request</code></p><p><code>-- @return schema.Heuristic table on successful detection or nil otherwise</code></p><p><code>function EmptyUserAgentHeuristic:detect(ctx)</code></p><p><code>   local ua = ctx.user_agent</code></p><p><code>   if not ua or ua == '' then</code></p><p><code>      return self.heuristic</code></p><p><code>   end</code></p><p><code>end</code></p><p><code>return _M</code></p></td><td><p><code>ref: empty-user-agent</code></p><p><code>      description: Empty or missing </code></p><p><code>User-Agent header</code></p><p><code>      action: add_bot_detection</code></p><p><code>      action_parameters:</code></p><p><code>        active_mode: false</code></p><p><code>      expression: http.user_agent eq </code></p><p><code>"" and cf.bot_management.ja4 = "t13d1516h2_8daaf6152771_b186095e22b6"</code></p></td></tr></table><p>The Golang heuristic that captured corporate proxy traffic as well (mentioned above) was one of the first to migrate to the new Ruleset engine. Before the migration, traffic matching on this heuristic had a false positive rate of 0.01%. While that sounds like a very small number, this means for every million bots we block, 100 real users saw a Cloudflare challenge page unnecessarily. At Cloudflare scale, even small issues can have real, negative impact.</p><p>When we analyzed the traffic caught by this heuristic rule in depth, we saw the vast majority of attack traffic came from a small number of abusive networks. After narrowing the definition of the heuristic to flag the Golang fingerprint only when it’s sourced by the abusive networks, the rule now has a false positive rate of 0.0001% (One out of 1 million).  Updating the heuristic to include the network context improved our accuracy, while still blocking millions of bots every week and giving us plenty of training data for our bot detection models. Because this heuristic is now more accurate, newer ML models make more accurate decisions on what’s a bot and what isn’t.</p>
    <div>
      <h3>New visibility and flexibility for Bot Management customers </h3>
      <a href="#new-visibility-and-flexibility-for-bot-management-customers">
        
      </a>
    </div>
    <p>While the new heuristics engine provides more accurate detections for all customers and a better experience for our analysts, moving to the Cloudflare Ruleset Engine also allows us to deliver new functionality for Enterprise Bot Management customers, specifically by offering more visibility. This new visibility is via a new field for Bot Management customers called Bot Detection IDs. Every heuristic we use includes a unique Bot Detection ID. These are visible to Bot Management customers in analytics, logs, and firewall events, and they can be used in the firewall to write precise rules for individual bots. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3cYXHw8tFUjdJQGm93gFcE/0a3f6ab89a70410ebb7dd2c6f4f3a677/1.png" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/9d7L1r7yN9AEhO26H7SgQ/434f0f934dd4f4498a8d13e85a7660ae/2.png" />
          </figure><p>Detections also include a specific tag describing the class of heuristic. Customers see these plotted over time in their analytics. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2UlkGQ070UWsmU76IXYqDd/6bca8f28959a8fe8f3013792a17b348a/image4.png" />
          </figure><p>To illustrate how this data can help give customers visibility into why we blocked a request, here’s an example request flagged by Bot Management (with the IP address, ASN, and country changed):</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3i6k9ejsBVwlbXUrZFIFJG/4c9cddd11d9f7a8ddf10eb5ff30a027b/4.png" />
          </figure><p>Before, just seeing that our heuristics gave the request a score of 1 was not very helpful in understanding why it was flagged as a bot. Adding our Detection IDs to Firewall Events helps to paint a better picture for customers that we’ve identified this request as a bot because that traffic used an empty user-agent. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5UQd20VnXCnIav1skHiX6i/18e0cf01106601ae7faf18be50d43365/5.png" />
          </figure><p>In addition to Analytics and Firewall Events, Bot Detection IDs are now available for Bot Management customers to use in Custom Rules, Rate Limiting Rules, Transform Rules, and Workers. </p>
    <div>
      <h4>Account takeover detection IDs</h4>
      <a href="#account-takeover-detection-ids">
        
      </a>
    </div>
    <p>One way we’re focused on improving Bot Management for our customers is by surfacing more attack-specific detections. During Birthday Week, we <a href="https://blog.cloudflare.com/a-safer-internet-with-cloudflare/"><u>launched Leaked Credentials Check</u></a> for all customers so that security teams could help <a href="https://www.cloudflare.com/zero-trust/solutions/account-takeover-prevention/"><u>prevent account takeover (ATO) attacks</u></a> by identifying accounts at risk due to leaked credentials. We’ve now added two more detections that can help Bot Management enterprise customers identify suspicious login activity via specific <a href="https://developers.cloudflare.com/bots/concepts/detection-ids/#account-takeover-detections"><u>detection IDs</u></a> that monitor login attempts and failures on the zone. These detection IDs are not currently affecting the bot score, but will begin to later in 2025. Already, they can help many customers detect more account takeover events now.</p><p>Detection ID <b>201326592 </b>monitors traffic on a customer website and looks for an anomalous rise in login failures (usually associated with brute force attacks), and ID <b>201326593 </b>looks for an anomalous rise in login attempts (usually associated with credential stuffing). </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4a2LGgB1bXGwFgHQEKFSI9/ff4194a6a470e466274f7b7c51e9dc18/6.png" />
          </figure>
    <div>
      <h3>Protect your applications</h3>
      <a href="#protect-your-applications">
        
      </a>
    </div>
    <p>If you are a Bot Management customer, log in and head over to the Cloudflare dashboard and take a look in Security Analytics for bot detection IDs <code>201326592</code> and <code>201326593</code>.</p><p>These will highlight ATO attempts targeting your site. If you spot anything suspicious, or would like to be protected against future attacks, create a rule that uses these detections to keep your application safe.</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[Bots]]></category>
            <category><![CDATA[Bot Management]]></category>
            <category><![CDATA[Application Security]]></category>
            <category><![CDATA[Machine Learning]]></category>
            <category><![CDATA[Heuristics]]></category>
            <category><![CDATA[Edge Rules]]></category>
            <category><![CDATA[Security]]></category>
            <guid isPermaLink="false">4IkgXzyemEEsN7A6Cd18hb</guid>
            <dc:creator>Curtis Lowder</dc:creator>
            <dc:creator>Brian Mitchell</dc:creator>
            <dc:creator>Adam Martinetti</dc:creator>
        </item>
        <item>
            <title><![CDATA[Go wild: Wildcard support in Rules and a new open-source wildcard crate]]></title>
            <link>https://blog.cloudflare.com/wildcard-rules/</link>
            <pubDate>Thu, 22 Aug 2024 14:00:00 GMT</pubDate>
            <description><![CDATA[ We’re excited to announce wildcard support across our Ruleset Engine-based products and our open-source wildcard crate in Rust. Configuring rules has never been easier, with powerful pattern matching enabling simple and flexible URL redirects and beyond for users on all plans. ]]></description>
            <content:encoded><![CDATA[ 
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5SVubtrh9iaqDDQSnA60Me/b511db040441d802b147cb838448ab26/2478-1-hero.png" />
          </figure><p>Back in 2012, we <a href="https://blog.cloudflare.com/introducing-pagerules-fine-grained-feature-co"><u>introduced</u></a> <a href="https://developers.cloudflare.com/rules/page-rules/"><u>Page Rules</u></a>, a pioneering feature that gave Cloudflare users unprecedented control over how their web traffic was managed. At the time, this was a significant leap forward, enabling users to define <a href="https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/"><u>patterns</u></a> for specific URLs and adjust Cloudflare <a href="https://developers.cloudflare.com/rules/page-rules/reference/settings/"><u>features</u></a> on a page-by-page basis. The ability to apply such precise configurations through a simple, user-friendly interface was a major advancement, establishing Page Rules as a cornerstone of our platform.</p><p>Page Rules allowed users to implement a variety of actions, including <a href="https://developers.cloudflare.com/rules/url-forwarding/#redirects"><u>redirects</u></a>, which automatically send visitors from one URL to another. Redirects are crucial for maintaining a seamless user experience on the Internet, whether it's guiding users <a href="https://developers.cloudflare.com/rules/url-forwarding/examples/redirect-new-url/"><u>from outdated links to new content</u></a> or managing traffic during <a href="https://developers.cloudflare.com/rules/url-forwarding/examples/redirect-all-different-hostname/"><u>site migrations</u></a>.</p><p>As the Internet has evolved, so too have the needs of our users. The demand for greater flexibility, higher performance, and more advanced capabilities led to the development of the <a href="https://developers.cloudflare.com/ruleset-engine/"><u>Ruleset Engine</u></a>, a powerful framework designed to handle complex rule evaluations with unmatched speed and precision.</p><p>In September 2022, we announced and released <a href="https://blog.cloudflare.com/dynamic-redirect-rules"><u>Single Redirects</u></a> as a modern replacement for the <a href="https://developers.cloudflare.com/rules/page-rules/how-to/url-forwarding/"><u>URL Forwarding</u></a> feature of Page Rules. Built on top of the Ruleset Engine, this new product offered a powerful syntax and enhanced performance.</p><p>Despite the <a href="https://blog.cloudflare.com/future-of-page-rules"><u>enhancements</u></a>, one of the most consistent pieces of feedback from our users was the need for wildcard matching and expansion, also known as <a href="https://github.com/begin/globbing"><u>globbing</u></a>. This feature is essential for creating dynamic and flexible URL patterns, allowing users to manage a broader range of scenarios with ease.</p><p>Today we are excited to announce that wildcard support is now available across our Ruleset Engine-based products, including <a href="https://developers.cloudflare.com/cache/how-to/cache-rules/"><u>Cache Rules</u></a>, <a href="https://developers.cloudflare.com/rules/compression-rules/"><u>Compression Rules</u></a>, <a href="https://developers.cloudflare.com/rules/configuration-rules/"><u>Configuration Rules</u></a>, <a href="https://developers.cloudflare.com/rules/custom-error-responses/"><u>Custom Errors</u></a>, <a href="https://developers.cloudflare.com/rules/origin-rules/"><u>Origin Rules</u></a>, <a href="https://developers.cloudflare.com/rules/url-forwarding/"><u>Redirect Rules</u></a>, <a href="https://developers.cloudflare.com/rules/snippets/"><u>Snippets</u></a>, <a href="https://developers.cloudflare.com/rules/transform/"><u>Transform Rules</u></a>, <a href="https://developers.cloudflare.com/waf/"><u>Web Application Firewall (WAF)</u></a>, <a href="https://developers.cloudflare.com/waiting-room/"><u>Waiting Room</u></a>, and more.</p>
    <div>
      <h3>Understanding wildcards</h3>
      <a href="#understanding-wildcards">
        
      </a>
    </div>
    <p>Wildcard pattern matching allows users to employ an asterisk <code>(*)</code> in a string to match certain patterns. For example, a single pattern like <code>https://example.com/*/t*st</code> can cover multiple URLs such as <code>https://example.com/en/test</code>, <code>https://example.com/images/toast</code>, and <code>https://example.com/blog/trust</code>.</p><p>Once a segment is captured, it can be used in another expression by referencing the matched wildcard with the <code>${&lt;X&gt;}</code> syntax, where <code>&lt;X&gt;</code> indicates the index of a matched pattern. This is particularly useful in URL forwarding. For instance, the URL pattern <code>https://example.com/*/t*st</code> can redirect to <code>https://${1}.example.com/t${2}st</code>, allowing dynamic and flexible URL redirection. This setup ensures that <code>https://example.com/uk/test</code> is forwarded to <code>https://uk.example.com/test</code>, <code>https://example.com/images/toast</code> to <code>https://images.example.com/toast</code>, and so on.</p>
    <div>
      <h3>Challenges with Single Redirects</h3>
      <a href="#challenges-with-single-redirects">
        
      </a>
    </div>
    <p>In Page Rules, redirecting from an old URI path to a new one looked like this:</p><ul><li><p><b>Source URL:</b> <code>https://example.com/old-path/*</code></p></li><li><p><b>Target URL:</b> <code>https://example.com/new-path/$1</code></p></li></ul><p>In comparison, replicating this behaviour in Single Redirects without wildcards required a more complex approach:</p><ul><li><p><b>Filter:</b> <code>(http.host eq "example.com" and starts_with(http.request.uri.path, "/old-path/"))</code></p></li><li><p><b>Expression:</b> <code>concat("/new-path/", substring(http.request.uri.path, 10)) (where 10 is the length of /old-path/)</code></p></li></ul><p>This complexity created unnecessary overhead and difficulty, especially for users without access to regular expressions (regex) or the technical expertise to come up with expressions that use nested functions.</p>
    <div>
      <h3>Wildcard support in Ruleset Engine</h3>
      <a href="#wildcard-support-in-ruleset-engine">
        
      </a>
    </div>
    <p>With the introduction of wildcard support across our Ruleset Engine-based products, users can now take advantage of the power and flexibility of the Ruleset Engine through simpler and more intuitive configurations. This enhancement ensures high performance while making it easier to create dynamic and flexible URL patterns and beyond.</p>
    <div>
      <h3>What’s new?</h3>
      <a href="#whats-new">
        
      </a>
    </div>
    
    <div>
      <h4>1) Operators "wildcard" and "strict wildcard" in Ruleset Engine:</h4>
      <a href="#1-operators-wildcard-and-strict-wildcard-in-ruleset-engine">
        
      </a>
    </div>
    <ul><li><p>"<b>wildcard</b>" (case insensitive): Matches patterns regardless of case (e.g., "test" and "TesT" are treated the same, similar to <a href="https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/"><u>Page Rules</u></a>).</p></li><li><p>"<b>strict wildcard</b>" (case sensitive): Matches patterns exactly, respecting case differences (e.g., "test" won't match "TesT").</p></li></ul><p>Both operators <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/operators/#wildcard-matching"><u>can be applied</u></a> to any string field available in the Ruleset Engine, including full URI, host, headers, cookies, user-agent, country, and more.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/46A6KAfGTCGykWIGiSLItF/c2b0743622244de48369da29fc7c4093/2478-2.png" />
          </figure><p></p><p>This example demonstrates the use of the "wildcard" operator in a <a href="https://developers.cloudflare.com/waf/"><u>Web Application Firewall (WAF)</u></a> rule applied to the User Agent field. This rule matches any incoming request where the User Agent string contains patterns starting with "Mozilla/" and includes specific elements like "Macintosh; Intel Mac OS ", "Gecko/", and "Firefox/". Importantly, the wildcard operator is case insensitive, so it captures variations like "mozilla" and "Mozilla" without requiring exact matches.</p>
    <div>
      <h4>2) Function <code>wildcard_replace()</code> in Single Redirects:</h4>
      <a href="#2-function-wildcard_replace-in-single-redirects">
        
      </a>
    </div>
    <p>In <a href="https://developers.cloudflare.com/rules/url-forwarding/single-redirects/"><u>Single Redirects</u></a>, the <code>wildcard_replace()</code> <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/functions/#wildcard_replace"><u>function</u></a> allows you to use matched segments in redirect URL targets.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5s2Y9zPgK4AqzD24DNSGU1/e8c456882160ad62b339888d05545f0d/2478-3.png" />
          </figure><p></p><p>Consider the URL pattern <code>https://example.com/*/t*st</code> mentioned earlier. Using <code>wildcard_replace()</code>, you can now set the target URL to <code>https://${1}.example.com/t${2}st</code> and dynamically redirect URLs like <code>https://example.com/uk/test</code> to <code>https://uk.example.com/test</code> and <code>https://example.com/images/toast</code> to <code>https://images.example.com/toast</code>.</p>
    <div>
      <h4>3) Simplified UI in Single Redirects:</h4>
      <a href="#3-simplified-ui-in-single-redirects">
        
      </a>
    </div>
    <p>We understand that not everyone wants to use advanced Ruleset Engine <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/functions/"><u>functions</u></a>, especially for simple URL patterns. That’s why we’ve introduced an easy and intuitive UI for <a href="https://developers.cloudflare.com/rules/url-forwarding/single-redirects/"><u>Single Redirects</u></a> called “wildcard pattern”. This new interface, available under the Rules &gt; Redirect Rules tab of the zone dashboard, lets you specify request and target URL wildcard patterns in seconds without needing to delve into complex functions, much like Page Rules.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1y72vKTVFZjDUglnTpC2Nl/3da615997c9e245858356e79dfbbd3ec/2478-4.png" />
          </figure><p></p>
    <div>
      <h3>How we built it</h3>
      <a href="#how-we-built-it">
        
      </a>
    </div>
    <p>The Ruleset Engine powering Cloudflare Rules products is written in <a href="https://www.rust-lang.org/"><u>Rust</u></a>. When adding wildcard support, we first explored existing <a href="https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html"><u>Rust crates</u></a> for wildcard matching.</p><p>We considered using the popular <a href="https://crates.io/crates/regex"><code><u>regex</u></code></a> crate, known for its robustness. However, it requires converting wildcard patterns into regular expressions (e.g., <code>*</code> to <code>.*</code>, and <code>?</code> to <code>.</code>) and escaping other characters that are special in regex patterns, which adds complexity.</p><p>We also looked at the <a href="https://crates.io/crates/wildmatch"><code><u>wildmatch</u></code></a> crate, which is designed specifically for wildcard matching and has a couple of advantages over <code>regex</code>. The most obvious one is that there is no need to convert wildcard patterns to regular expressions. More importantly, wildmatch can handle complex patterns efficiently: wildcard matching takes quadratic time – in the worst case the time is proportional to the length of the pattern multiplied by the length of the input string. To be more specific, the time complexity is <i>O(p + ℓ + s ⋅ ℓ)</i>, where <i>p</i> is the length of the wildcard pattern, <i>ℓ</i> the length of the input string, and <i>s</i> the number of asterisk metacharacters in the pattern. (If you are not familiar with <a href="https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/big-o-notation"><u>big O notation</u></a>, it is a way to express how an algorithm consumes a resource, in this case time, as the input size changes.) In the Ruleset Engine, we limit the number of asterisk metacharacters in the pattern to a maximum of 8. This ensures we will have good performance and limits the impact of a bad actor trying to consume too much CPU time by targeting extremely complicated patterns and input strings.</p><p>Unfortunately, <code>wildmatch</code> did not meet all our requirements. Ruleset Engine uses byte-oriented matching, and <code>wildmatch</code> works only on UTF-8 strings. We also have to support escape sequences –  for example, you should be able to represent a literal * in the pattern with <code>\*</code>.</p><p>Last but not least, to implement the <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/functions/#wildcard_replace"><code><u>wildcard_replace() function</u></code></a> we needed not only to be able to match, but also to be able to replace parts of strings with captured segments. This is necessary to dynamically create HTTP redirects based on the source URL. For example, to redirect a request from <code>https://example.com/*/page/*</code> to <code>https://example.com/products/${1}?page=${2}</code>, you should be able to define the target URL using an expression like this:</p>
            <pre><code>wildcard_replace(
http.request.full_uri, 
&amp;quot;https://example.com/*/page/*&amp;quot;, 
&amp;quot;https://example.com/products/${1}?page=${2}&amp;quot;
)</code></pre>
            <p></p><p>This means that in order to implement this function in the Ruleset Engine, we also need our wildcard matching implementation to capture the input substrings that match the wildcard’s metacharacters.</p><p>Given these requirements, we decided to build our own wildcard matching crate. The implementation is based on <a href="http://dodobyte.com/wildcard.html"><u>Kurt's 2016 iterative algorithm</u></a>, with optimizations from <a href="http://developforperformance.com/MatchingWildcards_AnImprovedAlgorithmForBigData.html"><u>Krauss’ 2014 algorithm</u></a>. (You can find more information about the algorithm <a href="https://github.com/cloudflare/wildcard/blob/v0.2.0/src/lib.rs#L555-L569"><u>here</u></a>). Our implementation supports byte-oriented matching, escape sequences, and capturing matched segments for further processing.</p><p>Cloudflare’s <a href="https://crates.io/crates/wildcard"><code><u>wildcard crate</u></code></a> is now available and is open-source. You can find the source repository <a href="https://github.com/cloudflare/wildcard"><u>here</u></a>. Contributions are welcome!</p>
    <div>
      <h3>FAQs and resources</h3>
      <a href="#faqs-and-resources">
        
      </a>
    </div>
    <p>For more details on using wildcards in Rules products, please refer to our updated Ruleset Engine documentation:</p><ul><li><p><a href="https://developers.cloudflare.com/ruleset-engine/rules-language/operators/#wildcard-matching"><u>Ruleset Engine Operators</u></a></p></li><li><p><a href="https://developers.cloudflare.com/ruleset-engine/rules-language/functions/#wildcard_replace"><u>Ruleset Engine Functions</u></a></p></li></ul><p>We value your feedback and invite you to share your thoughts in our <a href="https://community.cloudflare.com/t/wildcard-support-in-ruleset-engine-products/692658"><u>community forums</u></a>. Your input directly influences our product and design decisions, helping us make Rules products even better.</p><p>Additionally, check out our <a href="https://crates.io/crates/wildcard"><code><u>wildcard crate</u></code></a> implementation and <a href="https://github.com/cloudflare/wildcard"><u>contribute to its development</u></a>.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>The new wildcard functionality in Rules is available to all plans and is completely free. This feature is rolling out immediately, and no beta access registration required. </p><p>We are thrilled to offer this much-requested feature and look forward to seeing how you leverage wildcards in your Rules configurations. Try it now and experience the enhanced flexibility and performance. Your feedback is invaluable to us, so please let us know in <a href="https://community.cloudflare.com/t/wildcard-support-in-ruleset-engine-products/692658"><u>community</u></a> how this new feature works for you!</p> ]]></content:encoded>
            <category><![CDATA[CDN]]></category>
            <category><![CDATA[Edge Rules]]></category>
            <category><![CDATA[Open Source]]></category>
            <category><![CDATA[Rust]]></category>
            <category><![CDATA[Developers]]></category>
            <guid isPermaLink="false">1NVmSxeyTXrlaivG80ZNzS</guid>
            <dc:creator>Nikita Cano</dc:creator>
            <dc:creator>Diogo Sousa</dc:creator>
        </item>
        <item>
            <title><![CDATA[Simplify cloud routing and object storage configurations with Cloud Connector]]></title>
            <link>https://blog.cloudflare.com/cloud-connector/</link>
            <pubDate>Fri, 16 Aug 2024 14:00:00 GMT</pubDate>
            <description><![CDATA[ Meet Cloud Connector — a new free product to simplify your cloud routing and object storage configurations. Say goodbye to frustrating Host Header workarounds and hello to protecting your assets, accelerating applications, and routing your traffic between multiple cloud providers seamlessly ]]></description>
            <content:encoded><![CDATA[ 
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5VXjKvnAYhWJ1LYe6rCCyT/ab20954a0ed34a7ce5b23e5f1d7212fa/2472-1-Hero.png" />
          </figure><p>As part of Cloudflare's mission to help build a better Internet, we’re continuously integrating with other networks and service providers, ensuring ease of use for anyone, anywhere, anytime. </p><p>Today, we’re excited to announce Cloud Connector – a brand-new way to put Cloudflare in front of popular public cloud services, protecting your assets, <a href="https://www.cloudflare.com/application-services/solutions/"><u>accelerating applications</u></a>, and routing your traffic between multiple cloud providers seamlessly.</p><p>Cloud Connector is a natural extension of Cloudflare's <a href="https://www.cloudflare.com/connectivity-cloud/"><u>Connectivity Cloud</u></a>, which aims to simplify and secure the complex web of connections across today’s enterprises. Imagine <a href="https://developers.cloudflare.com/rules/origin-rules/"><u>Origin Rules</u></a>, but managed by Cloudflare, available for all plans, created with just a few clicks, and working out of the box without the need for additional rules. It allows you to route traffic to different public clouds without complicated workarounds. This means you can now direct specific requests to AWS S3, Google Cloud Storage, Azure Blob Storage, or our own <a href="https://www.cloudflare.com/developer-platform/r2/"><u>R2</u></a>, even if these services are not set as the DNS target for your hostname.</p><p>Whether you’re an <a href="https://www.cloudflare.com/ecommerce/"><u>e-commerce site</u></a> looking to route image traffic to the best-performing cloud storage for faster load times, a <a href="https://www.cloudflare.com/media-and-entertainment/"><u>media company</u></a> distributing video content efficiently across various cloud providers, or a developer wanting to simplify backend configurations, Cloud Connector is designed for you. It’s available for all Cloudflare plans, with a particular focus on Free, Pro, and Business customers.</p>
    <div>
      <h3>The Host header challenge</h3>
      <a href="#the-host-header-challenge">
        
      </a>
    </div>
    <p>Before Cloud Connector, many of our <a href="https://www.cloudflare.com/plans/free/"><u>Free</u></a>, <a href="https://www.cloudflare.com/plans/pro/"><u>Pro</u></a>, and <a href="https://www.cloudflare.com/plans/business/"><u>Business</u></a> customers faced a significant challenge: it was not straightforward to route traffic for the same hostname to one or more cloud providers on the backend. Something as simple as directing example.com/images to AWS S3 while keeping the rest of your site served by your origin web servers required multiple non-trivial steps to accomplish. Some users changed their setups, leveraging either <a href="https://www.cloudflare.com/developer-platform/workers/"><u>Workers</u></a>, chaining hostnames, or explored putting other service providers in front of their cloud destinations. While functional, this approach added complexity and increased effort, leading to frustration.</p><p>Enterprise customers had <a href="https://developers.cloudflare.com/rules/page-rules/how-to/rewrite-host-headers/"><u>Host Header</u></a> and <a href="https://developers.cloudflare.com/rules/page-rules/how-to/override-url-or-ip-address/"><u>Resolve Override</u></a> features to manage this, but the security and abuse risks associated with Host Header modification kept these features out of reach for everyone else.</p>
    <div>
      <h3>Simplifying multi-cloud routing</h3>
      <a href="#simplifying-multi-cloud-routing">
        
      </a>
    </div>
    <p>Today, we're excited to unveil Cloud Connector, designed to address these challenges head-on.</p><p>Imagine you’re managing a website where images are stored on AWS S3, videos on Google Cloud Storage, and static assets on Azure Blob Storage. Traditionally, routing traffic to these different providers would involve a series of complex steps and configurations. With Cloud Connector, this process is streamlined. You can seamlessly direct traffic for your hostname to multiple origins with just a few clicks. The setup is straightforward and doesn’t require any advanced configurations or additional rules.</p><p>For instance, you can now direct example.com/images to a specific <a href="https://developers.cloudflare.com/r2/buckets/"><u>R2 bucket</u></a> in your Cloudflare account effortlessly. This feature, previously exclusive to Enterprise customers, is now available to all users, ensuring that everyone can benefit from simplified cloud routing.</p>
    <div>
      <h3>How to configure</h3>
      <a href="#how-to-configure">
        
      </a>
    </div>
    <p>Getting started with Cloud Connector is easy. Navigate to the <b>Rules &gt; Cloud Connector</b> tab in your zone dashboard. From there, select your cloud provider:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6Iv4dPgAUh0gC46Y2LGwBz/8c220eca52d1c13662fd837ca594e396/2472-2.png" />
          </figure><p>
You’ll be presented with an interface where you can configure the destination hostname of your object storage bucket. Ensure that your bucket URL matches the expected schema for your cloud provider, such as .amazonaws.com for AWS S3 or storage.googleapis.com for Google Cloud Storage. In case of <a href="https://developers.cloudflare.com/r2/"><u>R2</u></a>, your bucket needs to be public and associated with <a href="https://developers.cloudflare.com/r2/buckets/public-buckets/#connect-a-bucket-to-a-custom-domain"><u>a custom domain</u></a>:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/53gSU119UIYjmFrzLAZMJx/ddd65062c6db6393d88d357515b0bda0/2472-3.png" />
          </figure><p>
Once you’ve configured your bucket, the next step is to determine which traffic is routed by Cloud Connector. Using the familiar rule builder interface that powers all our Rules products, you can filter requests based on hostname, URI path, headers, cookies, source IP, AS number, and more.</p><p>After configuring, deploy your rule, and it will be immediately effective:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1qXv7kCzvwftgAHrlqDgtA/dda2d9aa19de5ab4a5bbee6778db812e/2472-4.png" />
          </figure><p>
Cloud Connector is intentionally placed at the end of the <a href="https://developers.cloudflare.com/ruleset-engine/reference/phases-list/"><u>Ruleset Engine phase sequence</u></a> to ensure it works out of the box, even if there are active origin or configuration rules with matching criteria.</p><p>Cloud Connector simplifies your setup, allowing you to focus on what matters most: delivering a seamless experience for your users. By leveraging Cloudflare’s built-in security, your assets are automatically protected, and direct traffic routing optimizes application performance, accelerating load times and reducing your cloud bandwidth costs.</p>
    <div>
      <h3>Behind the scenes: how Cloud Connector works</h3>
      <a href="#behind-the-scenes-how-cloud-connector-works">
        
      </a>
    </div>
    <p>To build Cloud Connector, we leveraged our powerful, high performance <a href="https://developers.cloudflare.com/ruleset-engine/"><u>Ruleset Engine</u></a> and integrated it with various cloud providers, ensuring compatibility and optimal performance. Throughout this process, we were focused on making the setup as intuitive as possible, reducing the need for additional configurations and making it accessible to users of all technical backgrounds.</p><p>At its core, Cloud Connector builds on Cloudflare's existing Ruleset Engine, the same technology that powers <a href="https://developers.cloudflare.com/rules/origin-rules/"><u>Origin Rules</u></a>. Origin Rules typically operate during the <code>http_request_origin</code> <a href="https://developers.cloudflare.com/ruleset-engine/reference/phases-list/"><u>phase</u></a>, where they manage how requests are routed to different origins. A phase, in Cloudflare's system, represents a specific stage in the life of a request where rulesets can be executed. Each phase has a dedicated purpose, with rules defined at the account and zone levels to control different aspects of a request’s journey through our network.</p><p>Phases are essential because they allow us to apply actions at precise points in the request flow. For example, the http_request_origin phase focuses on routing, ensuring that traffic is directed to the correct origin based on the rules you set. By defining specific phases, we can optimize performance and enforce security measures at the right time without overlap or conflicts between different actions.</p><p>Rather than creating an entirely new system, we extended the existing <a href="https://developers.cloudflare.com/rules/origin-rules/create-api/"><u>"route" action</u></a> within Ruleset Engine to handle a specific set of pre-approved cloud provider endpoints, such as AWS S3, Google Cloud Storage, Azure Blob Storage, and <a href="https://www.cloudflare.com/developer-platform/products/r2/"><u>Cloudflare R2</u></a>.</p><p>To maintain the modularity of our system and avoid introducing product-specific abstractions into our core Ruleset Engine control plane, we developed <a href="https://developers.cloudflare.com/rules/cloud-connector/create-api/"><u>a thin API translator layer</u></a> on <a href="https://developers.cloudflare.com/workers/"><u>Workers</u></a>. This layer acts as an intermediary between the user-facing Cloud Connector API and the underlying Ruleset Engine API.</p><p>When a user <a href="https://developers.cloudflare.com/api/operations/zone-cloud-conenctor-rules-put"><u>creates</u></a> a Cloud Connector rule, it’s translated on the backend into a series of existing Ruleset Engine-based actions. For instance, if a user sets up a rule to route traffic to an AWS S3 bucket, our system translates this into actions that adjust the host header and origin settings to point to the S3 endpoint. This allows a single Cloud Connector rule to be decomposed into multiple rules within a zone’s entry point ruleset.</p><p>These rules are processed in reverse order, adhering to a "last rule wins" approach. This ensures that the final matching rule determines the traffic’s routing, preserving the behavior users expect. For example, if traffic is routed to an AWS S3 bucket, the system will first match the traffic based on the URI, then disable SSL if necessary, and finally route to the S3 origin. Once the appropriate rule is matched, a <a href="https://developers.cloudflare.com/ruleset-engine/managed-rulesets/create-exception/#skip-all-remaining-rules"><u>"skip" action</u></a> is invoked to prevent any further rules from altering the traffic, which prevents unintended behavior like disabling SSL for traffic routed to a different cloud provider.</p><p>When users <a href="https://developers.cloudflare.com/api/operations/zone-cloud-connector-rules"><u>retrieve</u></a> their Cloud Connector rules, the system reverses this process, reconstructing the original actions from the decomposed rules. This ensures that users see their configurations as they originally defined them, without needing to understand the underlying complexities.</p><p>To support Cloud Connector's unique requirements, we introduced a new request phase, <code>http_request_cloud_connector</code>. As the final request phase, this ensures that Cloud Connector rules have the last say in traffic routing decisions. This priority prevents conflicts with other routing rules, ensuring that traffic is securely and accurately routed according to the user’s intent.</p><p>Cloudflare is committed to building Cloudflare products on Cloudflare, leveraging existing technologies while innovating to meet new challenges. By building on <a href="https://developers.cloudflare.com/rules/origin-rules/"><u>Origin Rules</u></a> and <a href="https://developers.cloudflare.com/workers/"><u>Workers</u></a>, introducing the <code>http_request_cloud_connector</code> phase, and creating a thin API translation layer, we’ve developed a solution that simplifies multi-cloud routing without compromising on performance or security.</p>
    <div>
      <h3>What’s next for Cloud Connector?</h3>
      <a href="#whats-next-for-cloud-connector">
        
      </a>
    </div>
    <p>The current version of Cloud Connector is just the beginning. Our vision extends far beyond supporting <a href="https://www.cloudflare.com/learning/cloud/what-is-object-storage/"><u>object storage</u></a>. In the future, we aim to support all kinds of HTTP cloud services, including <a href="https://www.cloudflare.com/learning/performance/what-is-load-balancing/"><u>load balancers</u></a>, compute services, and more. We want Cloud Connector to be the primary way for Cloudflare users to discover and manage the cloud services they use across multiple providers.</p><p>Imagine being able to configure secure traffic routing to any cloud service without having to worry about DNS settings, Host headers, or SSL implementation. Our goal is to make Cloud Connector a comprehensive tool that simplifies the entire process, ensuring that you can focus on what matters most: building and scaling your web applications.</p>
    <div>
      <h3>Get started</h3>
      <a href="#get-started">
        
      </a>
    </div>
    <p>Cloud Connector is available in beta to all plans and is completely free. The rollout has started this month (August) and will be gradually released to all users throughout 2024. Once rolled out, users will start seeing this new product under the <b>Rules &gt; Cloud Connector</b> tab of their zone dashboard. No beta access registration is required.</p>
    <div>
      <h2>Learn more</h2>
      <a href="#learn-more">
        
      </a>
    </div>
    <p>Learn more about setting up and using Cloud Connector in <a href="https://developers.cloudflare.com/rules/cloud-connector/"><u>developer documentation</u></a>. Share your feedback in <a href="https://community.cloudflare.com/t/introducing-cloud-connector-simple-cloud-routing/698185"><u>community forums</u></a> – your opinion is invaluable and directly influences our product and design decisions, helping us to make Rules products even better.</p><p></p> ]]></content:encoded>
            <category><![CDATA[Edge Rules]]></category>
            <category><![CDATA[Cloud Connector]]></category>
            <category><![CDATA[CDN]]></category>
            <category><![CDATA[Connectivity Cloud]]></category>
            <category><![CDATA[Network Services]]></category>
            <guid isPermaLink="false">5JzuBm92IJFYqKUPCHgeFn</guid>
            <dc:creator>Nikita Cano</dc:creator>
        </item>
        <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>