<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: dongnaebi</title>
    <description>The latest articles on DEV Community by dongnaebi (@dongnaebi).</description>
    <link>https://dev.to/dongnaebi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1006516%2Fa4162bf0-7ae5-42a9-b68a-79d7d07c6983.jpg</url>
      <title>DEV Community: dongnaebi</title>
      <link>https://dev.to/dongnaebi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dongnaebi"/>
    <language>en</language>
    <item>
      <title>Customizing Cache Keys on Cloudflare's Free Plan</title>
      <dc:creator>dongnaebi</dc:creator>
      <pubDate>Mon, 18 Dec 2023 01:45:15 +0000</pubDate>
      <link>https://dev.to/dongnaebi/customizing-cache-keys-on-cloudflares-free-plan-9fb</link>
      <guid>https://dev.to/dongnaebi/customizing-cache-keys-on-cloudflares-free-plan-9fb</guid>
      <description>&lt;p&gt;Summary: I built a multilingual emoji search engine that can detect a user's language and automatically redirect them to the corresponding language page. To do this, I needed to customize the cache key but Cloudflare requires upgrading to an Enterprise plan to customize cache keys which was beyond my budget. After thorough research of their documentation, I successfully implemented the equivalent of a customized cache key using the Transform Rules configuration. In this article, I will share how I set this up. Even if you don't need to customize cache keys, the first half of this article can teach you some CDN and caching concepts.  &lt;/p&gt;

&lt;p&gt;Let me first introduce my websites to help you better understand the context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🧐 &lt;strong&gt;SearchEmoji&lt;/strong&gt; (&lt;a href="https://searchemoji.app/"&gt;https://searchemoji.app&lt;/a&gt;): A multilingual emoji search engine supporting 30 languages, vibrant emojis make your articles and social posts more lively&lt;/li&gt;
&lt;li&gt;✊ &lt;strong&gt;Yesicon&lt;/strong&gt; (&lt;a href="https://yesicon.app/"&gt;https://yesicon.app&lt;/a&gt;): A vector icon search engine supporting 8 languages, with over 200,000 high quality icons indexed, a ⌘CV helper for developers and designers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's get started! First I'll explain why we need to customize the cache key:&lt;/p&gt;

&lt;p&gt;Multilingual websites typically have the ability to detect the user's language and return the page in that language. The detection logic checks if the user has explicitly chosen a language before, which gets encoded and stored in a &lt;code&gt;lang&lt;/code&gt; cookie. On the server side, we first check the &lt;code&gt;lang&lt;/code&gt; cookie, and if empty fall back to the &lt;code&gt;Accept-Language&lt;/code&gt; header to determine the user's language.  &lt;/p&gt;

&lt;p&gt;This works fine when the user connects directly to the origin server, but to improve worldwide access speed sites typically use a CDN to cache and distribute content. Now imagine: a Chinese user visits the homepage so the Chinese version gets cached on the edge server with cache key of "/", then later an English user visits the homepage. Since there is a cached page for key "/", the edge server directly returns the cached Chinese page instead of fetching the English version from origin, leading to a poor user experience.&lt;/p&gt;

&lt;p&gt;The solution is simple - all CDN providers allow customizing the cache key, so we can append the &lt;code&gt;lang&lt;/code&gt; cookie and &lt;code&gt;Accept-Language&lt;/code&gt; header. For example instead of key "/", we use "/?lang=en&amp;amp;acceptLanguage=en-US,en". Now each language variation has a separate cache entry and avoids mixing languages.  &lt;/p&gt;

&lt;p&gt;The catch is Cloudflare requires upgrading to Enterprise plans for custom cache keys. This was my first time using Cloudflare as my other site Yesicon uses AWS Cloudfront CDN, which has no restrictions for cache keys and I easily configured custom keys there. I even considered migrating SearchEmoji to Cloudfront too but realized even their free tier wouldn't meet Yesicon's needs due to its popularity. So I decided to thoroughly research if I could achieve customized cache keys on Cloudflare without needing to upgrade!&lt;/p&gt;

&lt;p&gt;After 3 late nights of poring through Cloudflare docs and experimenting, I finally figured it out! The key is understanding this flow:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cKFcWRT0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cKFcWRT0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled.png" alt="Untitled" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a request enters the edge server, the URL gets rewritten first according to our rewrite rules before cache lookup. So we just need to rewrite the URL to include the &lt;code&gt;lang&lt;/code&gt; cookie and &lt;code&gt;Accept-Language&lt;/code&gt; header values. Here's how I simulated custom cache keys:  &lt;/p&gt;

&lt;p&gt;Let's walk through a user accessing &lt;a href="https://searchemoji.app/"&gt;https://searchemoji.app/&lt;/a&gt;. When it hits the edge server, we rewrite the URL to &lt;code&gt;https://searchemoji.app/?acceptLanguage=en-US,en&lt;/code&gt;. The first English user causes the English page to be cached with this URL as key. Now other English users will hit this cached page as they share the same rewritten URL. But Chinese users would get rewritten to &lt;code&gt;https://searchemoji.app/?acceptLanguage=zh-CN,zh,en&lt;/code&gt; so they will never see the English page. And if a user explicitly changes language, we just add the &lt;code&gt;lang&lt;/code&gt; cookie to the query string.&lt;/p&gt;

&lt;p&gt;But rewriting the URL dynamically isn't trivial - you need to understand &lt;a href="https://developers.cloudflare.com/ruleset-engine/rules-language/"&gt;Cloudflare's Rules language&lt;/a&gt;. In the Add Rule page, the top section is our rewrite condition - ours is complex so select &lt;code&gt;Edit expression&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3QBAolpX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled%25201.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3QBAolpX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled%25201.png" alt="Untitled" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We only want to apply this logic on the homepage. And we should only rewrite if the user's language is in our supported list, since those will properly match a language page. For English and other unsupported languages we don't rewrite since English is the default and unsupported languages also fallback to English. So here is the complete conditional check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# is home page &lt;/span&gt;
http.request.uri.path eq &lt;span class="s2"&gt;"/"&lt;/span&gt; and
&lt;span class="c"&gt;# user did not actively select English &lt;/span&gt;
not &lt;span class="o"&gt;(&lt;/span&gt;http.cookie contains &lt;span class="s2"&gt;"lang=en"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; and
&lt;span class="o"&gt;(&lt;/span&gt; 
    &lt;span class="c"&gt;# user actively selected supported non-English language  &lt;/span&gt;
    http.cookie contains &lt;span class="s2"&gt;"lang="&lt;/span&gt; or  
    &lt;span class="c"&gt;# browser language is a supported language &lt;/span&gt;
    substring&lt;span class="o"&gt;(&lt;/span&gt;http.request.accepted_languages[0], 0, 2&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;  
        &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"zh"&lt;/span&gt; &lt;span class="s2"&gt;"es"&lt;/span&gt; &lt;span class="s2"&gt;"de"&lt;/span&gt; &lt;span class="s2"&gt;"ja"&lt;/span&gt; &lt;span class="s2"&gt;"fr"&lt;/span&gt; &lt;span class="s2"&gt;"ko"&lt;/span&gt; &lt;span class="s2"&gt;"pt"&lt;/span&gt; &lt;span class="s2"&gt;"ru"&lt;/span&gt; &lt;span class="s2"&gt;"tr"&lt;/span&gt; &lt;span class="s2"&gt;"ar"&lt;/span&gt; &lt;span class="s2"&gt;"it"&lt;/span&gt; &lt;span class="s2"&gt;"hi"&lt;/span&gt; &lt;span class="s2"&gt;"pl"&lt;/span&gt; &lt;span class="s2"&gt;"bn"&lt;/span&gt; &lt;span class="s2"&gt;"nl"&lt;/span&gt; &lt;span class="s2"&gt;"uk"&lt;/span&gt; &lt;span class="s2"&gt;"id"&lt;/span&gt; &lt;span class="s2"&gt;"ms"&lt;/span&gt; &lt;span class="s2"&gt;"vi"&lt;/span&gt; &lt;span class="s2"&gt;"th"&lt;/span&gt; &lt;span class="s2"&gt;"sv"&lt;/span&gt; &lt;span class="s2"&gt;"el"&lt;/span&gt; &lt;span class="s2"&gt;"he"&lt;/span&gt; &lt;span class="s2"&gt;"fi"&lt;/span&gt; &lt;span class="s2"&gt;"no"&lt;/span&gt; &lt;span class="s2"&gt;"da"&lt;/span&gt; &lt;span class="s2"&gt;"ro"&lt;/span&gt; &lt;span class="s2"&gt;"hu"&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;  
&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added newlines and comments to help readability - remove those if copying the code.&lt;/p&gt;

&lt;p&gt;Now we need to actually rewrite the URL query string using dynamic variables:  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UcH76PB---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled%25202.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UcH76PB---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled%25202.png" alt="Untitled" width="761" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To extract the &lt;code&gt;lang&lt;/code&gt; value from the cookie, we can use a regex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;regex_replace&lt;span class="o"&gt;(&lt;/span&gt;http.cookie, &lt;span class="s2"&gt;"^.*lang=([^;]+).*&lt;/span&gt;&lt;span class="nv"&gt;$|&lt;/span&gt;&lt;span class="s2"&gt;^.*$"&lt;/span&gt;, &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To simplify later processing, we concatenate the &lt;code&gt;lang&lt;/code&gt; and &lt;code&gt;Accept-Language&lt;/code&gt; into one parameter. Here is the full rewrite rule:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;concat&lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="c"&gt;# query key  &lt;/span&gt;
    &lt;span class="s2"&gt;"cfcache="&lt;/span&gt;,   
    &lt;span class="c"&gt;# lang  &lt;/span&gt;
    regex_replace&lt;span class="o"&gt;(&lt;/span&gt;http.cookie, &lt;span class="s2"&gt;"^.*lang=([^;]+).*&lt;/span&gt;&lt;span class="nv"&gt;$|&lt;/span&gt;&lt;span class="s2"&gt;^.*$"&lt;/span&gt;, &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;,
    &lt;span class="c"&gt;# Accept-Language  &lt;/span&gt;
    http.request.accepted_languages[0]  
&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So a Spanish user would get rewritten to &lt;code&gt;https://searchemoji.app/?cfcache=es-ES&lt;/code&gt;, and if they explicitly switch language to English it would be &lt;code&gt;https://searchemoji.app/?cfcache=enes-ES&lt;/code&gt;. A delimiter between the languages could improve readability.  &lt;/p&gt;

&lt;p&gt;This works to add the parameter but has two issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If there are existing parameters, they get overridden resulting in lost parameters. For example visiting &lt;code&gt;https://searchemoji.app/?v=1&lt;/code&gt; gets rewritten losing the v=1 parameter to just &lt;code&gt;https://searchemoji.app/?cfcache=es-ES&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The added query parameter also persists after redirects. For example visiting &lt;code&gt;https://searchemoji.app/&lt;/code&gt; redirects to &lt;code&gt;https://searchemoji.app/?cfcache=es-ES&lt;/code&gt;, exposing the unsightly parameter to users.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You probably realized the first solution - we need to preserve any existing parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;concat&lt;span class="o"&gt;(&lt;/span&gt;  
    &lt;span class="c"&gt;# query key   &lt;/span&gt;
    &lt;span class="s2"&gt;"cfcache="&lt;/span&gt;,    
    &lt;span class="c"&gt;# lang   &lt;/span&gt;
    regex_replace&lt;span class="o"&gt;(&lt;/span&gt;http.cookie, &lt;span class="s2"&gt;"^.*lang=([^;]+).*&lt;/span&gt;&lt;span class="nv"&gt;$|&lt;/span&gt;&lt;span class="s2"&gt;^.*$"&lt;/span&gt;, &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;,  
    &lt;span class="c"&gt;# Accept-Language   &lt;/span&gt;
    http.request.accepted_languages[0],
    &lt;span class="c"&gt;# origin query  &lt;/span&gt;
    &lt;span class="s2"&gt;"&amp;amp;"&lt;/span&gt;,  
    http.request.uri.query  
&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But this is still not perfect - if the original URL has no query parameters, it will end with a trailing &amp;amp; symbol &lt;code&gt;https://searchemoji.app/?cfcache=es-ES&amp;amp;&lt;/code&gt;. Let's fix this and the second issue together:&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;?cfcache=xxx&lt;/code&gt; query parameter added by edge servers is purely for caching, but edge servers forward requests to origin with this parameter attached. And when origin handles multilanguage redirect logic, it also appends the parameter. Origin implements redirects by returning 302 status codes, so we need to strip the parameter in the &lt;code&gt;Location&lt;/code&gt; response header. I'm using &lt;code&gt;Nuxt 3&lt;/code&gt; - here is the full handling logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;nitroApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;render:response&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cfcache=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://searchemoji.app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;host&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// If there is &amp;amp; at the end of the parameter, it will be processed into { cfcache: 'es-ES&amp;amp;' }&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URLSearchParams&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// So we delete this parameter, &amp;amp; will also be deleted&lt;/span&gt;
    &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cfcache&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;host&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// Let edge servers cache 302 status&lt;/span&gt;
    &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cache-Control&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;max-age=86400, must-revalidate&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have perfectly simulated custom cache keys with a bit of extra work! Here is the final configuration:  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wlRYW8b_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled%25203.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wlRYW8b_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.searchemoji.app/acticle-image/Untitled%25203.png" alt="Untitled" width="800" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I still think Cloudflare should provide custom cache keys for all plans, perhaps for an additional cost.  &lt;/p&gt;

&lt;p&gt;Finally, I'd like to invite you to try my two sites (links at top) - whether you are a designer, developer, or creator emojis and icons can enhance your work. As the year draws to an end, adding some icons can spruce up your year-end review PowerPoint presentation and improve its aesthetics too! Feedback options are in the top right corner of the sites or comment below.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>cloudflare</category>
      <category>cdn</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
