
<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>Tue, 14 Apr 2026 21:25:00 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Speeding up your (WordPress) website is a few clicks away]]></title>
            <link>https://blog.cloudflare.com/speeding-up-your-website-in-a-few-clicks/</link>
            <pubDate>Thu, 22 Jun 2023 13:00:58 GMT</pubDate>
            <description><![CDATA[ In this blog, we will explain where the opportunities exist to improve website performance, how to check if a specific site can improve performance, and provide a small JavaScript snippet which can be used with Cloudflare Workers to do this optimization for you ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/h8hH7qWrYChGMYyrktaXj/163bb1bb8d730c069de5865285db1697/image1-31.png" />
            
            </figure><p>Every day, website visitors spend far too much time waiting for websites to load in their browsers. This waiting is partially due to browsers not knowing which resources are critically important so they can prioritize them ahead of less-critical resources. In this blog we will outline how millions of websites across the Internet can improve their performance by specifying which critical content loads first with Cloudflare Workers and what Cloudflare will do to make this easier by default in the future.</p><p>Popular Content Management Systems (CMS) like WordPress have made attempts to influence website resource priority, for example through techniques like <a href="https://make.wordpress.org/core/2020/07/14/lazy-loading-images-in-5-5/">lazy loading images</a>. When done correctly, the results are magical. Performance is optimized between the CMS and browser without needing to implement any changes or coding new prioritization strategies. However, we’ve seen that these default priorities have opportunities to improve greatly.</p><p>In this co-authored blog with Google’s Patrick Meenan we will explain where the opportunities exist to improve website performance, how to check if a specific site can improve performance, and provide a small JavaScript snippet which can be used with Cloudflare Workers to do this optimization for you.</p>
    <div>
      <h3>What happens when a browser receives the response?</h3>
      <a href="#what-happens-when-a-browser-receives-the-response">
        
      </a>
    </div>
    <p>Before we dive into where the opportunities are to <a href="https://www.cloudflare.com/learning/performance/speed-up-a-website/">improve website performance</a>, let’s take a step back to understand how browsers load website assets by default.</p><p>After the browser sends a <a href="https://www.cloudflare.com/learning/ddos/glossary/hypertext-transfer-protocol-http/">HTTP request</a> to a server, it receives a HTTP response containing information like status codes, headers, and the requested content. The browser carefully analyzes the response's status code and response headers to ensure proper handling of the content.</p><p>Next, the browser processes the content itself. For HTML responses, the browser extracts important information from the  section of the HTML, such as the page title, stylesheets, and scripts. Once this information is parsed, the browser moves on to the response  which has the actual page content. During this stage, the browser begins to present the webpage to the visitor.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/QXSvFomT1av14RMVga2Qf/e379b539ca63b484d47e9f14f128cada/image2-28.png" />
            
            </figure><p>If the response includes additional 3rd party resources like CSS, JavaScript, or other content, the browser may need to fetch and integrate them into the webpage. Typically, browsers like Google Chrome delay loading images until after the resources in the HTML  have loaded. This is also known as “<a href="https://developer.chrome.com/en/docs/lighthouse/performance/render-blocking-resources/">blocking</a>” the render of the webpage. However, developers can override this blocking behavior using <a href="https://web.dev/fetch-priority/">fetch priority</a> or other methods to boost other content’s priority in the browser. By adjusting an important image's fetch priority, it can be loaded earlier, which can lead to significant improvements in crucial performance metrics like LCP (<a href="https://web.dev/optimize-lcp/#:~:text=LCP%20measures%20the%20time%20from%20when%20the%20user%20initiates%20loading%20the%20page%20until%20the%20largest%20image">Largest Contentful Paint</a>).</p><p>Images are so central to web pages that they have become an essential element in measuring website performance from <a href="https://www.cloudflare.com/learning/performance/what-are-core-web-vitals/">Core Web Vitals</a>. LCP measures the time it takes for the largest visible element, often an image, to be fully rendered on the screen. Optimizing the loading of critical images (like <a href="https://web.dev/optimize-lcp/#:~:text=LCP%20measures%20the%20time%20from%20when%20the%20user%20initiates%20loading%20the%20page%20until%20the%20largest%20image">LCP images</a>) can greatly enhance performance, improving the overall user experience and page performance.</p><p>But here's the challenge – a browser may not know which images are the most important for the visitor experience (like the LCP image) until rendering begins. If the developer can identify the LCP image or critical elements before it reaches the browser, its priority can be increased at the server to boost website performance instead of waiting for the browser to naturally discover the critical images.</p><p>In our Smart Hints <a href="/smart-hints">blog</a>, we describe how Cloudflare will soon be able to automatically prioritize content on behalf of website developers, but what happens if there’s a need to optimize the priority of the images right now? How do you know if a website is in a suboptimal state and what can you do to improve?</p><p>Using Cloudflare, developers should be able to improve image performance with heuristics that identify likely-important images before the browser parses them so these images can have increased priority and be loaded sooner.</p>
    <div>
      <h3>Identifying Image Priority opportunities</h3>
      <a href="#identifying-image-priority-opportunities">
        
      </a>
    </div>
    <p>Just increasing the fetch priority of all images won't help if they are lazy-loaded or not critical/LCP images. <a href="https://www.cloudflare.com/learning/performance/what-is-lazy-loading/">Lazy-loading</a> is a method that developers use to generally improve the initial load of a webpage if it includes numerous out-of-view elements. For example, on Instagram, when you continually scroll down the application to see more images, it would only make sense to load those images when the user arrives at them otherwise the performance of the page load would be needlessly delayed by the browser eagerly loading these out-of-view images. Instead the highest priority should be given to the LCP image in the viewport to improve performance.</p><p>So developers are left in a situation where they need to know which images are on users' screens/viewports to increase their priority and which are off their screens to lazy-load them.</p><p>Recently, we’ve seen attempts to influence image priority on behalf of developers. For example, by <a href="https://make.wordpress.org/core/2020/07/14/lazy-loading-images-in-5-5/">default</a>, in WordPress 5.5 all images with an <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img">IMG tag</a> and <a href="https://en.wikipedia.org/wiki/Aspect_ratio_(image)">aspect ratios</a> were directed to be lazy-loaded. While there are plugins and other methods WordPress developers can use to boost the priority of LCP images, lazy-loading all images in a default manner and not knowing which are LCP images can cause artificial performance delays in website performance (they’re <a href="https://make.wordpress.org/core/2023/05/02/proposal-for-enhancing-lcp-image-performance-with-fetchpriority/">working on this</a> though, and have partially resolved this for <a href="https://make.wordpress.org/core/2023/04/05/wordpress-6-2-performance-improvements-for-all-themes/">block themes</a>).</p><p><i>So how do we identify the LCP image and other critical assets before they get to the browser?</i></p><p>To evaluate the opportunity to improve image performance, we turned to the <a href="https://httparchive.org/">HTTP Archive</a>. Out of the approximately 22 million desktop pages tested in February 2023, 46% had an <a href="https://web.dev/optimize-lcp/">LCP element</a> with an <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img">IMG tag</a>. Meaning that for page load metrics, LCP had an image included about half the time. Though, among these desktop pages, 8.5 million had the image in the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML">static HTML</a> delivered with the page, indicating a <b>total potential improvement opportunity of approximately 39% of the desktop pages</b> within the dataset.</p><p>In the case of mobile pages, out of the ~28.5 million tested, 40% had an LCP element as an IMG tag. Among these mobile pages, 10.3 million had the image in the static HTML delivered with the page, suggesting a potential <b>improvement opportunity in around 36% of the mobile pages</b> within the dataset.</p><p>However, as previously discussed, prioritizing an image won't be effective if the image is lazy-loaded because the directives are contradictory. In the dataset,  approximately 1.8 million LCP desktop images and 2.4 million LCP mobile images were lazy-loaded.</p><p>Therefore, across the Internet, the opportunity to improve image performance would be about ~30% of pages that have an LCP image in the original HTML markup that weren’t lazy-loaded, but with a more advanced Cloudflare Worker, the additional 9% of lazy-loaded LCP images can also be improved improved by removing the lazy-load attribute.</p><p>If you’d like to determine which element on your website serves as the <a href="https://web.dev/lcp/#what-elements-are-considered">LCP element</a> so you can increase the priority or remove any lazy-loading, you can use browser <a href="https://developer.chrome.com/docs/devtools/">developer tools</a>, or <a href="https://www.cloudflare.com/learning/performance/test-the-speed-of-a-website/">speed tests</a> like <a href="https://www.webpagetest.org/">Webpagetest</a> or <a href="https://dash.cloudflare.com?to=/:account/:zone/speed/test">Cloudflare Observatory</a>.</p><p>39% of desktop images seems like a lot of opportunity to improve image performance. So the next question is how can Cloudflare determine the LCP image across our network and automatically prioritize them?</p>
    <div>
      <h3>Image Index</h3>
      <a href="#image-index">
        
      </a>
    </div>
    <p>We thought that how soon the LCP image showed up in the HTML would serve as a useful indicator. So we analyzed the HTTP Archive dataset to see where the cumulative percentage of LCP images are discovered based on their position in the HTML, including lazy-loaded images.</p><p>We found that approximately 25% of the pages had the LCP image as the first image in the HTML (around 10% of all pages). Another 25% had the LCP image as the second image. WordPress seemed to arrive at a similar conclusion and recently <a href="https://make.wordpress.org/core/2023/04/05/wordpress-6-2-performance-improvements-for-all-themes/">released</a> a development to remove the default lazy-load attribute from the first image on block themes, but there are opportunities to go further.</p><p>Our analysis revealed that implementing a straightforward rule like "do not lazy-load the first four images," either through the browser, a content management system (CMS), or a Cloudflare Worker could address approximately 75% of the issue of lazy-loading LCP images (example Worker below).</p>
    <div>
      <h3>Ignoring small images</h3>
      <a href="#ignoring-small-images">
        
      </a>
    </div>
    <p>In trying to find other ways to identify likely LCP images we next turned to the size of the image. To increase the likelihood of getting the LCP image early in the HTML, we looked into ignoring “small” images as they are unlikely to be big enough to be a LCP element. We explored several sizes and 10,000 pixels (less than 100x100) was a pretty reliable threshold that didn’t skip many LCP images and avoided a good chunk of the non-LCP images.</p><p>By ignoring small images (&lt;10,000px), we found that the first image became the LCP image in approximately 30-34% of cases. Adding the second image increased this percentage to 56-60% of pages.</p><p>Therefore, to improve image priority, a potential approach could involve assigning a higher priority to the first four "not-small" images.</p>
    <div>
      <h3>Chrome 114 Image Prioritization Experiment</h3>
      <a href="#chrome-114-image-prioritization-experiment">
        
      </a>
    </div>
    <p>An experiment running in Chrome 114 does exactly what we described above. Within the browser there are a few different prioritization knobs to play with that aren’t web-exposed so we have the opportunity to assign a “medium” priority to images that we want to boost automatically (directly controlling priority with “fetch priority” lets you set high or low). This will let us move the images ahead of other images, async scripts and parser-blocking scripts late in the body but still keep the boosted image priority below any high-priority requests, particularly dynamically-injected blocking scripts.</p><p>We are experimenting with boosting the priority of varying numbers of images (2, 5 and 10) and with allowing one of those medium-priority images to load at a time during Chromes “tight” mode (when it is loading the render-blocking resources in the head) to increase the likelihood that the LCP image will be available when the first paint is done.</p><p>The data is still coming in and no “ship” decisions have been made yet but the early results are very promising, improving the LCP time across the entire web for all arms of the experiment (not by massive amounts but moving the metrics of the whole web is notoriously difficult).</p>
    <div>
      <h3>How to use Cloudflare Workers to boost performance</h3>
      <a href="#how-to-use-cloudflare-workers-to-boost-performance">
        
      </a>
    </div>
    <p>Now that we’ve seen that there is a large opportunity across the Internet for helping prioritize images for performance and how to identify images on individual pages that are likely LCP images, the question becomes, what would the results be of implementing a network-wide rule that could boost image priority from this study?</p><p>We built a test worker and deployed it on some WordPress test sites with our friends at <a href="https://rocket.net/">Rocket.net</a>, a WordPress hosting platform focused on performance. This worker boosts the priority of the first four images while removing the lazy-load attribute, if present. When deployed we saw good performance results and the expected image prioritization.</p>
            <pre><code>export default {
  async fetch(request) {
    const response = await fetch(request);
 
    // Check if the response is HTML
    const contentType = response.headers.get('Content-Type');
    if (!contentType || !contentType.includes('text/html')) {
      return response;
    }
 
    const transformedResponse = transformResponse(response);
 
    // Return the transformed response with streaming enabled
    return transformedResponse;
  },
};
 
async function transformResponse(response) {
  // Create an HTMLRewriter instance and define the image transformation logic
  const rewriter = new HTMLRewriter()
    .on('img', new ImageElementHandler());
 
  const transformedBody = await rewriter.transform(response).text()
 
  const transformresponse = new Response(transformedBody, response)
 
  // Return the transformed response with streaming enabled
  return transformresponse
}
 
class ImageElementHandler {
  constructor() {
    this.imageCount = 0;
    this.processedImages = new Set();
  }
 
  element(element) {
    const imgSrc = element.getAttribute('src');
 
    // Check if the image is small based on Chrome's criteria
    if (imgSrc &amp;&amp; this.imageCount &lt; 4 &amp;&amp; !this.processedImages.has(imgSrc) &amp;&amp; !isImageSmall(element)) {
      element.removeAttribute('loading');
      element.setAttribute('fetchpriority', 'high');
      this.processedImages.add(imgSrc);
      this.imageCount++;
    }
  }
}
 
function isImageSmall(element) {
  // Check if the element has width and height attributes
  const width = element.getAttribute('width');
  const height = element.getAttribute('height');
 
  // If width or height is 0, or width * height &lt; 10000, consider the image as small
  if ((width &amp;&amp; parseInt(width, 10) === 0) || (height &amp;&amp; parseInt(height, 10) === 0)) {
    return true;
  }
 
  if (width &amp;&amp; height) {
    const area = parseInt(width, 10) * parseInt(height, 10);
    if (area &lt; 10000) {
      return true;
    }
  }
 
  return false;
}</code></pre>
            <p>When testing the Worker, we saw that default image priority was boosted into “high” for the first four images and the fifth image remained “low.” This resulted in an LCP range of “<a href="https://web.dev/lcp/#:~:text=first%20started%20loading.-,What%20is%20a%20good%20LCP%20score%3F,across%20mobile%20and%20desktop%20devices.">good</a>” from a speed test. While this initial test is not a dispositive indicator that the Worker will boost performance in every situation, the results are promising and we look forward to continuing to experiment with this idea.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4jHIrp0orKEbGAppkSWVXq/1d0b5704b4ae310010e25a99599dfa49/image3-21.png" />
            
            </figure><p>While we’ve experimented with WordPress sites to illustrate the issues and potential performance benefits, this issue is present across the Internet.</p><p>Website owners can help us experiment with the Worker above to improve the priority of images on their websites or edit it to be more specific by targeting likely LCP elements. Cloudflare will continue experimenting using a very similar process to understand how to safely implement a network-wide rule to ensure that images are correctly prioritized across the Internet and performance is boosted without the need to configure a specific Worker.</p>
    <div>
      <h3>Automatic Platform Optimization</h3>
      <a href="#automatic-platform-optimization">
        
      </a>
    </div>
    <p>Cloudflare’s <a href="https://developers.cloudflare.com/automatic-platform-optimization/">Automatic Platform Optimization</a> (APO) is a plugin for WordPress which allows Cloudflare to deliver your entire WordPress site from our network ensuring consistent, fast performance for visitors. By serving cached sites, APO can improve performance metrics. APO does not currently have a way to prioritize images over other assets to improve browser render metrics or dynamically rewrite HTML, techniques we’ve discussed in this post. Although this presents a potential opportunity for future development, it requires thorough testing to ensure safe and reliable support.</p><p>In the future we’ll look to include the techniques discussed today as part of APO, however in the meantime we recommend using <a href="/snippets-announcement/">Snippets</a> (and <a href="/performance-experiments-with-cloudflare/">Experiments</a>) to test with the code example above to see the performance impact on your website.</p>
    <div>
      <h3>Get in touch!</h3>
      <a href="#get-in-touch">
        
      </a>
    </div>
    <p>If you are interested in using the JavaScript above, we recommended testing with <a href="https://workers.cloudflare.com/">Workers</a> or using <a href="/snippets-announcement/">Cloudflare Snippets</a>. We’d love to hear from you on what your results were. Get in touch via social media and share your experiences.</p> ]]></content:encoded>
            <category><![CDATA[Speed Week]]></category>
            <category><![CDATA[Automatic Platform Optimization]]></category>
            <category><![CDATA[WordPress]]></category>
            <guid isPermaLink="false">5VIbkWZzUAIMJDqTVlKR8i</guid>
            <dc:creator>Alex Krivit</dc:creator>
            <dc:creator>Patrick Meenan (Guest Author)</dc:creator>
        </item>
        <item>
            <title><![CDATA[Automatic Platform Optimization post-launch report]]></title>
            <link>https://blog.cloudflare.com/apo-post-launch-report/</link>
            <pubDate>Tue, 16 Mar 2021 12:00:00 GMT</pubDate>
            <description><![CDATA[ We explored almost 200 websites with the activated Automatic Platform Optimization feature in Chrome User Experience Report data. Automatic Platform Optimization consistently demonstrated better aggregate performance among sites we analyzed in TTFB, First Paint, FCP, and LCP metrics. ]]></description>
            <content:encoded><![CDATA[ <p>Last year during <a href="/automatic-platform-optimizations-starting-with-wordpress/">Birthday Week</a>, we announced Automatic Platform Optimization for WordPress (APO): smart HTML caching for WordPress sites using Cloudflare. Initial testing across various WordPress sites demonstrated significant improvements in performance metrics like Time to First Byte (TTFB), First Contentful Paint (FCP), and Speed Index. We wanted to measure how APO impacted web performance for our customers since the launch.</p><p>In the blog post, we answer the following questions:</p><ul><li><p>How fast is Automatic Platform Optimization? Can you demonstrate it with data?</p></li></ul><p>We will show real-world improvements for several performance metrics.</p><ul><li><p>Is Automatic Platform Optimization flexible enough to integrate smoothly with my WordPress site?</p></li></ul><p>We have added and improved lots of features since the initial launch.</p><ul><li><p>Will Automatic Platform Optimization work when used with other plugins?</p></li></ul><p>We will cover the most common use cases and explain how Automatic Platform Optimization could be fined-tuned.</p>
    <div>
      <h2>Measuring performance with WebPageTest</h2>
      <a href="#measuring-performance-with-webpagetest">
        
      </a>
    </div>
    <p>We use WebPageTest as a go-to tool for <a href="/new-speed-page/">synthetic testing at Cloudflare</a>. It measures web performance metrics in real browsers, is highly programmable, and could scale to test millions of sites per day. Among the benefits of synthetic testing are easy to produce results and their relatively high reproducibility.</p><p>Automatic Platform Optimization internal testing with WebPageTest demonstrated a very promising 72% reduction in Time to First Byte (TTFB) and 23% reduction to <a href="https://web.dev/fcp/">First Contentful Paint</a>. Follow <a href="/automatic-platform-optimizations-starting-with-wordpress/#the-benefits-of-automatic-platform-optimization">the original blog post</a> to learn more about our test setup and results analysis.</p>
    <div>
      <h2>Measuring performance with the Chrome User Experience Report</h2>
      <a href="#measuring-performance-with-the-chrome-user-experience-report">
        
      </a>
    </div>
    <p>In comparison to synthetic testing, Real User Monitoring (RUM) is invaluable in painting the picture of how a website performs in real-world conditions: on different form factors and variable connection types. Although noise to signal ratio could be high in RUM data, there is no substitute for measuring web performance in the wild.</p><p>We analyzed Google's <a href="https://developers.google.com/web/tools/chrome-user-experience-report">Chrome User Experience Report</a> of Automatic Platform Optimization websites and compared results from two months before enabling CrUX to the two months after. We present results of Time To First Byte, First Paint, First Contentful Paint, and Largest Contentful Paint.</p>
    <div>
      <h3>Time To First Byte by device</h3>
      <a href="#time-to-first-byte-by-device">
        
      </a>
    </div>
    <p>Time To First Byte (TTFB) is the time taken from the user or client making an HTTP request until the first byte arrives back to the browser.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7ukvHUfnTwdV6G9O2tInJK/da54e8a03550745d5c304c3664cacdb0/image1-15.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/nDmdI6LfhEhCmwrw8YAdE/6f4d30993e12970e71a0ad6efb0499b6/image6-5.png" />
            
            </figure><p>Automatic Platform Optimization improvements in the TTFB metric demonstrated the largest increase in the 'good' bucket and the largest decrease in the 'poor' bucket both on desktop and phone form factors among all metrics. The improvement in the 'poor' bucket on mobile demonstrates how Automatic Platform Optimization makes a difference even on slow connection types like 3G, 2G, slow 2G. Faster response times with Automatic Platform Optimization from edge servers translate directly into quicker TTFB timings, positively affecting all other performance measurements.</p>
    <div>
      <h3>First Paint by device</h3>
      <a href="#first-paint-by-device">
        
      </a>
    </div>
    <p>First Paint measures the first time the browser rendered any content. First Paint signifies the earliest point when something happens on the screen after a user requests a page. It is a good proxy for a user believing the website is not broken.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5crFujbvMLpxg5SWITmSm5/c8159070f9395e2b2a22b44bd860efad/image3-12.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6aaGYS8TwMdLUbyI75g7jA/69edacd19a63b2f3bbc013e056537fb8/image7-4.png" />
            
            </figure><p>Almost a 10% increase in the 'good' bucket on a desktop is the highlight for the First Paint metric. It's nice to see a clear trend of improvement in both desktop and phone data. It's also worth mentioning that the exact values used to define 'good’, 'moderate’, and the 'poor' buckets are picked arbitrarily for each timing metric. This trend means it's more important to look at the percentage of improvement rather than absolute values for each 'bucket'.</p>
    <div>
      <h3>First Contentful Paint by device</h3>
      <a href="#first-contentful-paint-by-device">
        
      </a>
    </div>
    <p>First Contentful Paint (FCP) metric measures how long a page takes to start rendering any text, image, non-white canvas, or SVG content. FCP is a good indicator of perceived speed as it portrays how long people wait to see the first signs of a site loading.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4DmAXL8e0YkFDplrWevrkS/f4f720ab35931d8b6afd5f7ff034f54d/image8-4.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6SPbEFcNeYbmiKYAkGnLZk/1b9f60e6c36257cb45ff879498aaa0ee/image5-12.png" />
            
            </figure><p>It is the third straight metric that has been improved in both form factors after customers activated Automatic Platform Optimization. FCP happens even later than the First Paint event. We can draw a hypothesis that Automatic Platform Optimization positively impacts the loading performance metrics of the site. Still, the later the event happens, the less impact Automatic Platform Optimization has on that particular metric.</p>
    <div>
      <h3>Largest Contentful Paint by device</h3>
      <a href="#largest-contentful-paint-by-device">
        
      </a>
    </div>
    <p>The Largest Contentful Paint (LCP) metric reports the render time for the largest image or text block visible within the viewport.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5VPFYu1C2Z4QJGbIUVuOTn/c41163eabc93b087c93a6da4a2f2a329/image4-11.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1UvAakum79HmgCxkdj9Hw3/4223477af4ccc5ca6dbf702ce2d3da5d/image2-10.png" />
            
            </figure><p>Our hypothesis holds ground with LCP as well. Interestingly enough, the positive impact of Automatic Platform Optimization activation is relatively equal on desktops and phones.</p>
    <div>
      <h3>Summary</h3>
      <a href="#summary">
        
      </a>
    </div>
    <p>Overall, Automatic Platform Optimization consistently demonstrated better aggregate performance among sites we analyzed in TTFB, First Paint, FCP, and LCP metrics. Even more impressive are improvements on both desktop and phone form factors. It’s worth pointing out that apart from noticeable differences in hardware characteristics, phone data capture all mobile connection types from slow 2G to fast 4G.</p><p>We explored almost 200 websites with the activated Automatic Platform Optimization feature in Chrome User Experience Report data. To smooth the variance, we combined two months of data before and after Automatic Platform Optimization activation. To further decrease inaccuracy, we dropped a month’s worth of data that included the activation period. As an example, for a website that activated Automatic Platform Optimization last October, we used Chrome User Experience Report measurements from August and September as the <code>before</code> bucket. The <code>after</code> bucket combined data from November and December.</p><p>It is important to note that due to the limitations of iOS, Chrome User Experience Report mobile results don't include devices running Apple's mobile operating system.</p><p>Chrome User Experience Report data provides performance metrics per geographic location, form factor, or connection type. We analyzed aggregated data across all countries and connection types to focus on the overall performance.</p>
    <div>
      <h2>Extended Automatic Platform Optimization Functionality</h2>
      <a href="#extended-automatic-platform-optimization-functionality">
        
      </a>
    </div>
    <p>Since the product launch, we have been listening carefully to the customers' reports of Automatic Platform Optimization’s missing functionality or unexpected behavior. The number of different use cases our customers have underlines how broad the WordPress ecosystem is. One of the advantages of Automatic Platform Optimization utilizing the Workers platform is that we can quickly iterate and release in a matter of hours instead of days or weeks. Granted, some features like Cache By Device Type or subdomains support took us longer to build. Still, for apparent bugs or missing functionality, the ability to release on demand made all the difference for the team and our customers.</p><p>We start the second part of the report with a brief description of the features we have released since October. Afterward, we will paint a bigger picture of how Automatic Platform Optimization fits together with a broad WordPress plugins ecosystem.</p>
    <div>
      <h3>Smart caching for marketing query parameters</h3>
      <a href="#smart-caching-for-marketing-query-parameters">
        
      </a>
    </div>
    <p>By default Automatic Platform Optimization doesn’t cache pages with query parameters. One of the first feature requests from the community was to add caching support for marketing attribution (for example, UTMs) query parameters. We did exactly that, and the full list of the supported parameters is in <a href="https://support.cloudflare.com/hc/en-us/articles/360049822312#h_01EN42YA87TDRX47MSB2XC61Q9">the documentation</a>.</p>
    <div>
      <h3>Improved cache hit ratio</h3>
      <a href="#improved-cache-hit-ratio">
        
      </a>
    </div>
    <p>Cloudflare provides <a href="https://support.cloudflare.com/hc/en-us/articles/200172516">static caching</a> out of the box by default. The caching system for static content relies on file extensions to determine the content type. In contrast, HTML pages don't always have file extensions in the URL. That's why Automatic Platform Optimization caching relies on HTTP's <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation">content negotiation mechanism</a> for HTML content.</p><p>We check both the request's Accept and the response's Content-Type headers for the 'text/html' substring. When humans access sites on the Internet, browsers send correct Accept headers behind the scene. When bots access the sites, they don't always send Accept headers. Initially, the Automatic Platform Optimization cache passed all requests without a valid Accept header to the origin servers. When customers tried to migrate from using the "Cache Everything" page rule to only using Automatic Platform Optimization, they noticed extra load on the origin servers.. Now all GET and HEAD requests are checked against the Automatic Platform Optimization cache. The change noticeably improved the cache hit ratio for all Automatic Platform Optimization customers and enhanced page loads for good bots.</p>
    <div>
      <h3>Improved security</h3>
      <a href="#improved-security">
        
      </a>
    </div>
    <p><a href="https://portswigger.net/research/practical-web-cache-poisoning">Cache poisoning</a> is a common attack vector against any caching system. One of the benefits of Automatic Platform Optimization is that most of the logic runs on edge servers, and we can update it without any changes on the origin server. To mitigate potential cache poisoning, we released a new version to bypass caching if any of the following request headers are present:</p><ul><li><p>X-Host</p></li><li><p>X-Forwarded-Host</p></li><li><p>X-Original-URL</p></li><li><p>X-Rewrite-URL</p></li></ul><p>Additionally, any GET request <a href="https://portswigger.net/research/web-cache-entanglement#fatget">with a body</a> will bypass Automatic Platform Optimization caching.</p>
    <div>
      <h3>Page Rules integration</h3>
      <a href="#page-rules-integration">
        
      </a>
    </div>
    <p>Automatic Platform Optimization's primary goal is to improve page load performance while keeping the configuration as simple as possible. On the other hand, the Automatic Platform Optimization service should allow fine-tuning for advanced use cases. One such mechanism is Cloudflare's <a href="https://support.cloudflare.com/hc/en-us/articles/218411427-Understanding-and-Configuring-Cloudflare-Page-Rules-Page-Rules-Tutorial-">Page Rules</a>. As of today, Automatic Platform Optimization supports the following rules:</p><ul><li><p>Cache Level: Bypass</p></li><li><p>Cache Level: Ignore Query String</p></li><li><p>Cache Level: Cache Everything</p></li><li><p>Bypass Cache on Cookie (Biz and Ent plans only)</p></li><li><p>Edge Cache TTL</p></li><li><p>Browser Cache TTL</p></li></ul><p>For a detailed description, refer to the <a href="https://support.cloudflare.com/hc/en-us/articles/360049822312-Understanding-Automatic-Platform-Optimization-APO-with-WordPress#h_01ER098Z0DRS95ERCMZRV3022S">official documentation</a>.</p>
    <div>
      <h3>Subdomain Support</h3>
      <a href="#subdomain-support">
        
      </a>
    </div>
    <p>Automatic Platform Optimization aims to provide seamless integration with the WordPress ecosystem. It recognizes specific cookies for the most popular plugins like WooCommerce, JetPack, BigCommerce, Easy Digital Downloads, etc.</p><p>Currently, we limit Automatic Platform Optimization usage to WordPress sites. During the initial launch, we restricted Automatic Platform Optimization to run against root domains only, but we learned later of the high demand to run Automatic Platform Optimization on subdomains. To make it possible, we updated both the plugin and <a href="https://api.cloudflare.com/#zone-settings-change-automatic-platform-optimization-for-wordpress-setting">API</a> to allow Automatic Platform Optimization to run on subdomains. Three steps are required to enable Automatic Platform Optimization on a subdomain:</p><ul><li><p>Install version 3.8.7 or later of the Cloudflare WordPress plugin.</p></li><li><p>Log in using Global key. (You can only use an API token for the root domain.)</p></li><li><p>Enable APO. The subdomain displays in the list of hostnames in the card.</p></li></ul><p>The initial cost of $5 per month for Free plans includes running Automatic Platform Optimization against any number of subdomains.</p>
    <div>
      <h3>Caching by Device Type</h3>
      <a href="#caching-by-device-type">
        
      </a>
    </div>
    <p>The majority of site visits come from users accessing the web on <a href="https://www.perficient.com/insights/research-hub/mobile-vs-desktop-usage-study">mobile devices</a>. And website visitors expect sites to work well on mobile devices. In fact, responsive design is a recommended approach for websites. APO works well for responsive design websites because the cache's content will adjust to the client's screen size seamlessly. The alternative method is to serve different markup on mobile browsers.</p><p>Many popular WordPress plugins add a mobile-friendly theme to the site. For sites with such plugins installed, Automatic Platform Optimization breaks functionality by serving the same cached version for all users. As we learned about the growing number of customers with this problem, we looked for the solution. Cloudflare’s caching already has support for <a href="https://support.cloudflare.com/hc/en-us/articles/229373388-Understand-Cache-by-Device-Type-Enterprise-plans-only-">cache by device type</a> functionality, but it's only available for customers on the Enterprise plan. As was a case for the <a href="https://support.cloudflare.com/hc/en-us/articles/236166048">Bypass Cache on Cookie</a> page rule, we decided to include the functionality as part of the Automatic Platform Optimization offering. As a recap, Caching by Device Type relies on the User-Agent request header for detection. There are three types:</p><ul><li><p>Mobile</p></li><li><p>Tablet</p></li><li><p>Everything else</p></li></ul><p>For each type, the Cloudflare cache will store content in a separate bucket. To enable caching by device type, either navigate to the dashboard's Automatic Platform Optimization card or the Cloudflare WordPress plugin. We recommend using a single cache whenever possible because caching by device type can decrease cache hit ratio and increase the load on origin servers.</p>
    <div>
      <h3>Other noticeable changes</h3>
      <a href="#other-noticeable-changes">
        
      </a>
    </div>
    <p>There are many improvements including:</p><ul><li><p>Improved purging infrastructure of content from KV.</p></li><li><p>Extended automatic cache purging for categories and tags.</p></li><li><p>Addressed many edge cases for Google Fonts optimization.</p></li><li><p>Added support for HEAD requests.</p></li><li><p>Automated release pipeline for the Cloudflare WordPress plugin.</p></li></ul>
    <div>
      <h2>Improved WordPress plugins compatibility</h2>
      <a href="#improved-wordpress-plugins-compatibility">
        
      </a>
    </div>
    <p>There are over 50,000 WordPress plugins currently available for download, and because there are so many, we can't test the compatibility of Automatic Platform Optimization with each one individually. We do know, however, that it's vital to provide compatibility for the most popular plugins. Thanks to the vibrant community, we quickly learned about the most widely used issues with Automatic Platform Optimization caching. The plugins that experienced problems could be grouped into the following categories:</p><ul><li><p>Plugins with custom cookies</p></li><li><p>Plugins with geolocation functionality</p></li><li><p>Plugins with mobile themes</p></li><li><p>Plugins with AMP support</p></li><li><p>Plugins that generate HTML</p></li><li><p>Caching and optimizations plugins</p></li></ul><p>Let's review those categories and available solutions for improved compatibility.</p>
    <div>
      <h3>Plugins with custom cookies</h3>
      <a href="#plugins-with-custom-cookies">
        
      </a>
    </div>
    <p>One of the critical features Automatic Platform Optimization provides out of the box is cookie-based rules to bypass APO caching. For any plugin that uses custom cookies, Automatic Platform Optimization requires extending the rules. We have a list of <a href="https://support.cloudflare.com/hc/en-us/articles/360049822312#h_01EQ44V6KRFM6Z0F06MM0EJGJ5">supported plugins</a> that uses our cookies bypass logic.</p>
    <div>
      <h3>Plugins with geolocation functionality</h3>
      <a href="#plugins-with-geolocation-functionality">
        
      </a>
    </div>
    <p>This broad category of plugins relies on geolocation information based on the client's (visitor) IP address (connecting to Cloudflare) to provide its functionality. Early on, we had a misconfiguration in Automatic Platform Optimization functionality that resulted in sending a dummy IP address in the CF-Connecting-IP request header that was forwarded to the origin server.</p><p>This behavior effectively broke the functionality of the widely used Wordfence Security plugin. We promptly released a fix. Because we use Cloudflare Workers internally, Cloudflare Workers treated Automatic Platform Optimization requests sent to the origin as cross-zone requests due to security concerns. As a result, <a href="https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-Cloudflare-handle-HTTP-Request-headers-">the CF-Connecting-IP</a> header value was replaced with a dummy IP address. The change was to send the Automatic Platform Optimization worker's subrequest to the origin as a same-zone request to pass the real client IP without a security concern. Also, Automatic Platform Optimization now sends the client's IP via the X-Forwarded-For request header to the origin to improve plugin compatibility.</p>
    <div>
      <h3>Plugins with mobile themes</h3>
      <a href="#plugins-with-mobile-themes">
        
      </a>
    </div>
    <p>There are several WordPress plugins that render custom themes for mobile visitors. Those plugins rely on the browser's User-Agent to detect visitors from mobile devices. In December, we released Automatic Platform Optimization support for the "Cache by device type" feature. With a single configuration change, you can activate a separate cache based on the device type: mobile, tablet, and everything else. You can learn more about the feature in the <a href="https://support.cloudflare.com/hc/en-us/articles/360049822312#h_01ERZ6QHBGFVPSC44SJAC1YM6Q">official documentation</a>.</p>
    <div>
      <h3>Plugins with AMP support</h3>
      <a href="#plugins-with-amp-support">
        
      </a>
    </div>
    <p>The AMP (<a href="https://amp.dev/">Accelerated Mobile Pages</a>) project's goal is to make the web, and, in particular, the mobile web, much more pleasant to surf. The AMP HTML framework is designed to help web pages load quickly and avoid distracting the user with irrelevant content.</p><p>The most popular AMP WordPress plugins render AMP-compatible markup when the page URL contains the amp= query parameter. AMP markup is a subset of HTML with several restrictions and we looked into possible solutions to provide Automatic Platform Optimization caching for AMP pages. It requires a separate cache for AMP pages similar to the "Cache by device type" feature. Considering Google's recent push with Core Web Vitals, the AMP format's importance will decrease going forward. Based on the complexity of supporting dedicated AMP caching and Google's deprioritization of the AMP format, we decided to bypass Automatic Platform Optimization caching of AMP pages.</p><p>There are two possible approaches for caching AMP pages. The first one is to change the URL schema for AMP pages from, for example, site.com/page/?amp= to site.com/amp/page/. With this option, Automatic Platform Optimization caches AMP pages out of the box. Another solution is to activate the "Cache Everything" Page rule for AMP pages served with amp= query parameter. Note that AMP pages will require manual cache purging in both cases on content change.</p>
    <div>
      <h3>Plugins that generate HTML</h3>
      <a href="#plugins-that-generate-html">
        
      </a>
    </div>
    <p>Using Automatic Platform Optimization with Page Rules makes it possible to:</p><ul><li><p>Bypass caching pages that contain CAPTCHAs.</p></li><li><p>Set Edge TTL for pages that contain nonces or server-rendered ads to six hours or shorter.</p></li></ul>
    <div>
      <h3>Caching and optimizations plugins</h3>
      <a href="#caching-and-optimizations-plugins">
        
      </a>
    </div>
    <p>Among the most popular caching and optimizations WordPress plugins are LiteSpeed Cache, W3 Total Cache, WP Rocket, WP Fastest Cache, WP Super Cache, Autoptimize. To successfully activate Advanced Platform Optimization when any of the plugins above already present, follow these steps:</p><ul><li><p><a href="https://support.cloudflare.com/hc/en-us/articles/360049822312#h_01EKKWPM2KC6H9CD0ATX98KG1C">Install</a> and activate the Cloudflare WordPress plugin.</p></li><li><p>Enable Automatic Platform Optimization in the plugin.</p></li><li><p>Clear any server cache used via other plugins.</p></li><li><p>Verify that your origin starts serving the response header "cf-edge-cache: cache,platform=wordpress".</p></li></ul><p>That should make caching plugins and Automatic Platform Optimization compatible.</p><p>In using optimizations features inside the plugins, additional steps are necessary to integrate with Automatic Platform Optimization. Any of the following plugin's optimizations require subsequent purging of Cloudflare cache:</p><ul><li><p>JavaScript minification and async-loading</p></li><li><p>CSS minification, inlining, and aggregation</p></li><li><p>HTML minification</p></li><li><p>Images optimization and lazy-loading</p></li><li><p>Google fonts optimizations</p></li></ul><p>There are three potential solutions we discuss in the order of preference.</p>
    <div>
      <h4>1. Use Cloudflare products</h4>
      <a href="#1-use-cloudflare-products">
        
      </a>
    </div>
    <p>Most of the optimizations are possible with Cloudflare today:</p><ul><li><p>Auto Minify provides minification for HTML, CSS, and JavaScript</p></li><li><p>Rocket Loader provides JavaScript lazy loading</p></li><li><p>Mirage and Image-resizing allows image optimization and lazy-loading</p></li><li><p>Advanced Platform Optimization optimizes Google fonts out of the box</p></li></ul>
    <div>
      <h4>2. Activate plugins integration with Cloudflare</h4>
      <a href="#2-activate-plugins-integration-with-cloudflare">
        
      </a>
    </div>
    <ul><li><p>WP Rocket <a href="https://docs.wp-rocket.me/article/18-using-wp-rocket-with-cloudflare">integrates</a> with Cloudflare API.</p></li><li><p>WP Fastest Cache <a href="https://www.wpfastestcache.com/tutorial/wp-fastest-cache-cloudflare/">integrates</a> with Cloudflare API.</p></li><li><p>W3 Total Cache <a href="https://kinsta.com/blog/w3-total-cache/#how-to-set-up-w3-total-cache-with-the-cloudflare-extension">integrates</a> with Cloudflare API. Make sure to enable the Page Caching option.</p></li></ul>
    <div>
      <h4>3. Integration with Cloudflare cache purging</h4>
      <a href="#3-integration-with-cloudflare-cache-purging">
        
      </a>
    </div>
    <p>The rest of the plugins in the list, when producing content optimizations, require triggering of Cloudflare cache purging manually or via <a href="https://api.cloudflare.com/#zone-purge-files-by-url">API</a>:</p><ul><li><p>LiteSpeed Cache</p></li><li><p>WP Super Cache</p></li><li><p>Autoptimize</p></li></ul>
    <div>
      <h3>Summary</h3>
      <a href="#summary">
        
      </a>
    </div>
    <p>Automatic Platform Optimization is compatible with the most popular caching plugins. Content optimizations should be preferably migrated to Cloudflare offerings. Alternatively, plugins require triggering Cloudflare cache purging via API integration. The action of the last resort is to disable plugins optimizations but keep caching functionality.</p><p>We work closely with the WordPress plugins community to improve compatibility with Advanced Platform Optimization.</p>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Automatic Platform Optimization demonstrated improved performance metrics in both synthetic and real-world settings. The public Chrome User Experience Report dataset proved to be an invaluable source of RUM metrics for web performance analysis. Automatic Platform Optimization showed noticeable improvements on desktops and phones. TTFB is the most improved metric, but we also noticed positive changes in the First Paint, First Contentful Paint, and Largest Contentful Paint metrics.</p><p>It has been intensive and rewarding several months since the Automatic Platform Optimization launch, and we greatly increased Automatic Platform Optimization applicability based on customer feedback. Our <a href="https://community.cloudflare.com/">community forum</a> is a great place to get help and ask questions about Cloudflare products, including Advanced Platform Optimization.</p><p>There are more exciting Automatic Platform Optimization improvements the team is actively working on, and we can't wait to share them. Stay tuned!</p> ]]></content:encoded>
            <category><![CDATA[Automatic Platform Optimization]]></category>
            <category><![CDATA[WordPress]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[Cache]]></category>
            <category><![CDATA[Performance]]></category>
            <guid isPermaLink="false">3f2zJqUMBglhwX15U1lOPm</guid>
            <dc:creator>Yevgen Safronov</dc:creator>
        </item>
        <item>
            <title><![CDATA[Building Automatic Platform Optimization for WordPress using Cloudflare Workers]]></title>
            <link>https://blog.cloudflare.com/building-automatic-platform-optimization-for-wordpress-using-cloudflare-workers/</link>
            <pubDate>Fri, 02 Oct 2020 13:00:00 GMT</pubDate>
            <description><![CDATA[ zero-config edge caching and optimizations for improved performance for WordPress. Reduce WordPress plugin burden. ]]></description>
            <content:encoded><![CDATA[ <p>This post explains how we implemented the <a href="/automatic-platform-optimizations-starting-with-wordpress/">Automatic Platform Optimization</a> for WordPress. In doing so, we have defined a new place to run WordPress plugins, at the edge written with Cloudflare Workers. We provide the feature as a Cloudflare service but what’s exciting is that anyone could build this using the Workers platform.</p><p>The service is an evolution of the ideas explained in an earlier <a href="/improving-html-time-to-first-byte/">zero-config edge caching of HTML</a> blog post. The post will explain how Automatic Platform Optimization combines the best qualities of the regular Cloudflare cache with Workers KV to improve cache cold starts globally.</p><p>The optimization will work both with and without the <a href="https://support.cloudflare.com/hc/en-us/articles/227634427-Using-Cloudflare-with-WordPress">Cloudflare for WordPress plugin</a> integration. Not only have we provided a zero config edge HTML caching solution but by using the Workers platform we were also able to improve the performance of <a href="/fast-google-fonts-with-cloudflare-workers/">Google font loading</a> for all pages.</p><p>We are launching the feature first for WordPress specifically but the concept can be applied to any website and/or content management system (CMS).</p>
    <div>
      <h3>A new place to run WordPress plugins?</h3>
      <a href="#a-new-place-to-run-wordpress-plugins">
        
      </a>
    </div>
    <p>There are many individual WordPress plugins for performance that use similar optimizations to existing Cloudflare services. Automatic Platform Optimization is bringing them all together into one easy to use solution, deployed at the edge.</p><p>Traditionally you have to maintain server plugins with your WordPress installation. This comes with maintenance costs and can require a deep understanding of how to fine tune performance and security for each and every plugin. Providing the optimizations on the client side can also lead to performance problems due to the <a href="https://v8.dev/blog/cost-of-javascript-2019">costs of JavaScript</a> execution. In contrast most of the optimizations could be built-in in Cloudflare’s edge rather than running on the server or the client. Automatic Platform Optimization will be always up to date with the latest performance and <a href="https://www.cloudflare.com/learning/security/how-to-improve-wordpress-security/">security best practices</a>.</p>
    <div>
      <h3>How to optimize for WordPress</h3>
      <a href="#how-to-optimize-for-wordpress">
        
      </a>
    </div>
    <p>By default Cloudflare CDN caches assets based on <a href="https://support.cloudflare.com/hc/en-us/articles/200172516#h_a01982d4-d5b6-4744-bb9b-a71da62c160a">file extension</a> and doesn’t cache HTML content. It is possible to configure HTML caching with a <a href="https://support.cloudflare.com/hc/en-us/articles/202775670#3SVKvGhbS9BNT34zRCsPJ7">Cache Everything Page</a> rule but it is a manual process and often requires additional features only available on the Business and Enterprise plans. So for the majority of the WordPress websites even with a <a href="https://www.cloudflare.com/learning/cdn/what-is-a-cdn/">CDN</a> in front them, HTML content is not cached. Requests for a HTML document have to go all the way to the origin.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/14SelFUXAc9SBPwqea8OUD/92f9e753055a0759bc0f87ef7c021bca/image3-2.png" />
            
            </figure><p>Even if a CDN optimizes the connection between the closest edge and the website’s origin, the origin could be located far away and also be <a href="https://www.cloudflare.com/learning/cdn/common-cdn-issues/">slow to respond</a>, especially under load.</p>
    <div>
      <h3>Move content closer to the user</h3>
      <a href="#move-content-closer-to-the-user">
        
      </a>
    </div>
    <p>One of the primary recommendations for speeding up websites is to move content closer to the end-user. This reduces the amount of time it takes for packets to travel between the end-user and the web server - the <a href="https://www.cloudflare.com/learning/cdn/glossary/round-trip-time-rtt/">round-trip time (RTT)</a>. This improves the speed of establishing a connection as well as serving content from a closer location.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/VJdt6X0xF6xuDyMI0CHXu/4e17456b4b864eb1b5eabc08713a4438/image6-1.png" />
            
            </figure><p>We have previously blogged about the <a href="/improving-html-time-to-first-byte/">benefits of edge caching HTML</a>. Caching and serving from HTML from the Cloudflare edge will greatly improve the time to first byte (TTFB) by optimizing DNS, connection setup, SSL negotiation, and removing the origin server response time.If your origin is slow in generating HTML and/or your user is far from the origin server then all your performance metrics will be affected.</p><p>Most HTML isn’t really dynamic. It needs to be able to change relatively quickly when the site is updated but for a huge portion of the web, the content is static for months or years at a time. There are special cases like when a user is logged-in (as the admin or otherwise) where the content needs to differ but the vast majority of visits are of anonymous users.</p>
    <div>
      <h3>Zero config edge caching revisited</h3>
      <a href="#zero-config-edge-caching-revisited">
        
      </a>
    </div>
    <p>The goal is to make updating content to the edge happen automatically. The edge will cache and serve the previous version content until there is new content available. This is usually achieved by triggering a cache purge to remove existing content. In fact using a combination of our <a href="https://www.cloudflare.com/integrations/wordpress/">WordPress plugin</a> and <a href="https://api.cloudflare.com/#zone-purge-files-by-url">Cloudflare cache purge API</a>, we already support <a href="https://support.cloudflare.com/hc/en-us/articles/115002708027-Cloudflare-WordPress-Plugin-Automatic-Cache-Management-">Automatic Cache Purge on Website Updates</a>. This feature has been in use for many years.</p><p>Building automatic HTML edge caching is more nuanced than caching traditional static content like images, styles or scripts. It requires defining rules on what to cache and when to update the content. To help with that task we introduced a custom header to communicate caching rules between Cloudflare edge and origin servers.</p><p>The Cloudflare Worker runs from every edge data center, the serverless platform will take care of scaling to our needs. Based on the request type it will return HTML content from Cloudflare Cache using <a href="https://developers.cloudflare.com/workers/runtime-apis/cache">Worker’s Cache API</a> or serve a response directly from the origin. Specifically designed custom header provides information from the origin on how the script should handle the response. For example worker script will never cache responses for authenticated users.</p>
    <div>
      <h3>HTML Caching rules</h3>
      <a href="#html-caching-rules">
        
      </a>
    </div>
    <p>With or without Cloudflare for WordPress plugin, HTML edge caching requires all of the following conditions to be met:</p><ul><li><p>Origin responds with 200 status</p></li><li><p>Origin responds with "text/html" content type</p></li><li><p>Request method is GET.</p></li><li><p>Request path doesn’t contain query strings</p></li><li><p>Request doesn’t contain any WordPress specific cookies: "wp-*", "wordpress*", "comment_*", "woocommerce_*" unless it’s "wordpress_eli" or "wordpress_test_cookie".</p></li><li><p>Request doesn’t contain any of the following headers:</p><ul><li><p>"Cache-Control: no-cache"</p></li><li><p>"Cache-Control: private"</p></li><li><p>"Pragma:no-cache"</p></li><li><p>"Vary: *"</p></li></ul></li></ul><p>Note that the caching is bypassed if the devtools are open and the “Disable cache” option is active.</p>
    <div>
      <h3>Edge caching with plugin</h3>
      <a href="#edge-caching-with-plugin">
        
      </a>
    </div>
    <p>The preferred solution requires a <a href="https://support.cloudflare.com/hc/en-us/articles/227634427-Using-Cloudflare-with-WordPress">configured Cloudflare for WordPress plugin</a>. We provide the following features set when the plugin is activated:</p><ul><li><p>HTML edge caching with 30 days TTL</p></li><li><p>30 seconds or faster cache invalidation</p></li><li><p>Bypass HTML caching for logged in users</p></li><li><p>Bypass HTML caching based on presence of WordPress specific cookies</p></li><li><p>Decrease load on origin servers. If a request is fetched from Cloudflare CDN Cache we skip the request to the origin server.</p></li></ul>
    <div>
      <h3>How is this implemented?</h3>
      <a href="#how-is-this-implemented">
        
      </a>
    </div>
    <p>When an eyeball requests a page from a website and Cloudflare doesn’t have a copy of the content it will be fetched from the origin. As the response is sent from the origin and goes through Cloudflare’s edge, Cloudflare for WordPress plugin adds a custom header: <code>cf-edge-cache</code>. It allows an origin to configure caching rules applied on responses.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6COdQPrdIxdu1UiJgsdyVd/015cf3f6aa598f70cfe089d74292a1b9/image4-1.png" />
            
            </figure><p>Based on the <a href="/improving-html-time-to-first-byte/">X-HTML-Edge-Cache</a> proposal the plugin adds a cf-edge-cache header to every origin response. There are 2 possible values:</p><ul><li><p>cf-edge-cache: no-cache</p></li></ul><p>The page contains private information that shouldn’t be cached by the edge. For example, an active session exists on the server.</p><ul><li><p>cf-edge-cache: cache, platform=wordpress</p></li></ul><p>This combination of cache and platform will ensure that the HTML page is cached. In addition, we ran a number of checks against the presence of WordPress specific cookies to make sure we either bypass or allow caching on the Edge.</p><p>If the header isn’t present we assume that the Cloudflare for WordPress plugin is not installed or up-to-date. In this case the feature operates without a plugin support.</p>
    <div>
      <h3>Edge caching without plugin</h3>
      <a href="#edge-caching-without-plugin">
        
      </a>
    </div>
    <p>Using the Automatic Platform Optimization feature in combination with Cloudflare for WordPress plugin is our recommended solution. It provides the best feature set together with almost instant cache invalidation. Still, we wanted to provide performance improvements without the need for any installation on the origin server.</p><p>We provide the following features set when the plugin is not activated:</p><ul><li><p>HTML edge caching with 30 days TTL</p></li><li><p>Cache invalidation may take up to 30 minutes. A manual cache purge could be triggered to speed up cache invalidation</p></li><li><p>Bypass HTML caching based on presence of WordPress specific cookies</p></li><li><p>No decreased load on origin servers. If a request is fetched from Cloudflare CDN Cache we still require an origin response to apply cache invalidation logic.</p></li></ul><p>Without Cloudflare for WordPress plugin we still cache HTML on the edge and serve the content from the cache when possible. The logic of cache revalidation happens after serving the response to the eyeball. <a href="https://developers.cloudflare.com/workers/learning/fetch-event-lifecycle#waituntil">Worker’s waitUntil() callback</a> allows the user to run code without affecting the response to the eyeball and is run in background.</p><p>We rely on the following headers to detect whether the content is stale and requires cache update:</p><ul><li><p>ETag. If the cached version and origin response both include ETag and they are different we replace cached version with origin response. The behavior is the same for strong and weak ETag values.</p></li><li><p>Last-Modified. If the cached version and origin response both include Last-Modified and origin has a later Last-Modified date we replace cached version with origin response.</p></li><li><p>Date. If no ETag or Last-Modified header is available we compare cached version and origin response Date values. If there was more than a 30 minutes difference we replace cached version with origin response.</p></li></ul>
    <div>
      <h3>Getting content everywhere</h3>
      <a href="#getting-content-everywhere">
        
      </a>
    </div>
    <p>Cloudflare Cache works great for the frequently requested content. Regular requests to the site make sure the content stays in cache. For a typical personal blog, it will be more common that the content stays in cache only in some parts of our vast edge network. With the Automatic Platform Optimization release we wanted to improve loading time for cache cold start from any location in the world. We explored different approaches and decided to use <a href="/introducing-workers-kv/">Workers KV</a> to improve Edge Caching.</p><p>In addition to Cloudflare's CDN cache we put the content into Workers KV. It only requires a single request to the page to cache it and within a minute it is made available to be read back from KV from any Cloudflare data center.</p>
    <div>
      <h3>Updating content</h3>
      <a href="#updating-content">
        
      </a>
    </div>
    <p>After an update has been made to the WordPress website the plugin makes a request to Cloudflare’s API which both purges cache and marks content as stale in KV. The next request for the asset will trigger revalidation of the content. If the plugin is not enabled cache revalidation logic is triggered as detailed previously.</p><p>We serve the stale copy of the content still present in KV and asynchronously fetch new content from the origin, apply possible optimizations and then cache it (both regular local CDN cache and globally in KV).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1UGnbwtDfcNEmZXwV12urw/b1b58beeb7a4c5fee4ad8d5a8d755035/image5-2.png" />
            
            </figure><p>To store the content in KV we use a single namespace. It’s keyed with a combination of a zone identifier and the URL. For instance:</p>
            <pre><code>1:example.com/blog-post-1.html =&gt; "transformed &amp; cached content"</code></pre>
            <p>For marking content as stale in KV we write a new key which will be read from the edge. If the key is present we will revalidate the content.</p>
            <pre><code>stale:1:example.com/blog-post-1.html =&gt; ""</code></pre>
            <p>Once the content was revalidated the stale marker key is deleted.</p>
    <div>
      <h3>Moving optimizations to the edge</h3>
      <a href="#moving-optimizations-to-the-edge">
        
      </a>
    </div>
    <p>On top of caching HTML at the edge, we can pre-process and transform the HTML to make the loading of websites even faster for the user. Moving the development of this feature to our Cloudflare Workers environment makes it easy to add performance features such as improving <a href="/fast-google-fonts-with-cloudflare-workers/">Google Font loading</a>. Using Google Fonts can cause significant performance issues as to load a font requires loading the HTML page; then loading a CSS file and finally loading the font. All of these steps are using different domains.</p><p>The solution is for the worker to inline the CSS and serve the font directly from the edge minimizing the number of connections required.</p><p>If you read through the previous blog post’s implementation it required a lot of manual work to provide streaming HTML processing support and character encodings. As the set of worker APIs have improved over time it is now much simpler to implement. Specifically the addition of a streaming <a href="/html-parsing-2/">HTML rewriter/parser with CSS-selector based API</a> and the ability to suspend the parsing to <a href="/asynchronous-htmlrewriter-for-cloudflare-workers/">asynchronously fetch a resource</a> has reduced the code required to implement this from ~600 lines of source code to under 200.</p>
            <pre><code>export function transform(request, res) {
  return new HTMLRewriter()
    .on("link", {
      async element(e) {
        const src = e.getAttribute("href");
        const rel = e.getAttribute("rel");
        const isGoogleFont =
          src.startsWith("https://fonts.googleapis.com")

        if (isGoogleFont &amp;&amp; rel === "stylesheet") {
          const media = e.getAttribute("media") || "all";
          const id = e.getAttribute("id") || "";
          try {
            const content = await fetchCSS(src, request);
            e.replace(styleTag({ media, id }, content), {
              html: true
            });
          } catch (e) {
            console.error(e);
          }
        }
      }
    })
    .transform(res);
}</code></pre>
            <p>The HTML transformation doesn’t block the response to the user. It’s running as a background task which when complete will update kv and replace the global cached version.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1ShahwSObRage83CdWSfD0/528448594de96d64c0bb442f7e2db875/image1-6.png" />
            
            </figure>
    <div>
      <h3>Making edge publishing generic</h3>
      <a href="#making-edge-publishing-generic">
        
      </a>
    </div>
    <p>We are launching the feature for WordPress specifically but the concept can be applied to any website and content management system (CMS).</p> ]]></content:encoded>
            <category><![CDATA[Automatic Platform Optimization]]></category>
            <category><![CDATA[Birthday Week]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[WordPress]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Serverless]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <category><![CDATA[Developers]]></category>
            <guid isPermaLink="false">TmM1U951RKeF4WEDa64px</guid>
            <dc:creator>Yevgen Safronov</dc:creator>
            <dc:creator>Sven Sauleau</dc:creator>
        </item>
        <item>
            <title><![CDATA[Introducing Automatic Platform Optimization, starting with WordPress]]></title>
            <link>https://blog.cloudflare.com/automatic-platform-optimizations-starting-with-wordpress/</link>
            <pubDate>Fri, 02 Oct 2020 13:00:00 GMT</pubDate>
            <description><![CDATA[ Today, we are announcing a new service to serve more than just the static content of your website with the Automatic Platform Optimization (APO) service. With this launch, we're supporting WordPress. ]]></description>
            <content:encoded><![CDATA[ 
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7pBDoI1dESTWbQFz0Vcsa6/76dfc80f250f0dec6cfd442c2a0dae7d/Birthday-Week-OG-images_WordPress_Optimization.png" />
          </figure><p>Today, we are announcing a new service to serve more than just the static content of your website with the <a href="https://www.cloudflare.com/application-services/products/automatic-platform-optimization/">Automatic Platform Optimization (APO)</a> service. With this launch, we are supporting WordPress, the most popular website hosting solution serving 38% of all websites. Our testing, as detailed below, showed a 72% reduction in Time to First Byte (TTFB), 23% reduction to <a href="https://web.dev/fcp/">First Contentful Paint</a>, and 13% reduction in <a href="https://web.dev/speed-index/">Speed Index</a> for desktop users at the 90th percentile, by serving nearly all of your website’s content from Cloudflare’s network. This means visitors to your website see not only the first content sooner but all content more quickly.</p><p>With Automatic Platform Optimization for WordPress, your customers won’t suffer any slowness caused by common issues like shared hosting congestion, slow database lookups, or misbehaving plugins. This service is now available for anyone using WordPress.</p>
    <div>
      <h3>Automatic Platform Optimization Pricing</h3>
      <a href="#automatic-platform-optimization-pricing">
        
      </a>
    </div>
    <p>APO for WordPress costs $5/month for customers on our Free plan and is included, at no additional cost, in our Professional, Business, and Enterprise <a href="https://www.cloudflare.com/plans/">plans</a>. No usage fees, no surprises, <i>just speed</i>.</p>
    <div>
      <h3>How to get started</h3>
      <a href="#how-to-get-started">
        
      </a>
    </div>
    <p>The easiest way to get started with APO is from your WordPress admin console.</p><p><b>1</b>. First, install the <a href="https://wordpress.org/plugins/cloudflare/">Cloudflare WordPress plugin</a> on your WordPress website or update to the latest version (3.8.2 or higher).
<b>2</b>. Authenticate the plugin (<a href="https://wordpress.org/plugins/cloudflare/#installation">steps here</a>) to talk to Cloudflare if you have not already done that.
<b>3</b>. From the Home screen of the Cloudflare section, turn on Automatic Platform Optimization.

Free customers will first be directed to the <a href="https://dash.cloudflare.com/?to=/:account/:zone/speed/optimization">Cloudflare Dashboard</a> to purchase the service.</p>
    <div>
      <h3>Why We Built This</h3>
      <a href="#why-we-built-this">
        
      </a>
    </div>
    <p>At Cloudflare, we jump at the opportunity to make hard problems for our customers disappear with the click of a button. Running a consistently fast website is challenging. Many businesses don’t have the time nor money to spend on complicated and expensive performance solutions for their site. Even if they do, it can be extremely costly to pay for specialized attention to ensure you get the best performance possible. Having a fast website doesn’t have to be complicated, though. <b>The closer your content is to your customers, the better your site will perform.</b> Static content caching does this for files like images, CSS and JavaScript, but that is only part of the equation. Dynamic content is still fetched from the origin incurring costly round trips and additional processing time. For more info on dynamic versus static content, see our <a href="https://www.cloudflare.com/learning/cdn/caching-static-and-dynamic-content/">learning center</a>.</p><p>WordPress is one of the most open platforms in the world, but that means you are always at risk of incurring performance penalties because of plugins or other sources that, while necessary, may be hard to pinpoint and resolve. With the Automatic Platform Optimization service, we put your website into our network that is within 10 milliseconds of 99% of the Internet-connected population in the developed world, all without having to change your existing <a href="https://www.cloudflare.com/developer-platform/solutions/hosting/">hosting</a> provider. This means that for most requests your customers won’t even need to go to your origin, reducing many costly round trips and server processing time. These optimizations run on our edge network, so they also will not impact render or interactivity since no additional JavaScript is run on the client.</p>
    <div>
      <h3>How We Measure Web Performance</h3>
      <a href="#how-we-measure-web-performance">
        
      </a>
    </div>
    <p>Evaluating performance of a website is difficult. There are many different metrics you can track and it is not always obvious which metrics most meaningfully represent a user’s experience. As discussed when we <a href="https://blog.cloudflare.com/new-speed-page/">blogged</a> about our new <a href="https://dash.cloudflare.com/?to=/:account/:zone/speed">Speed page</a>, we aim to simplify this for customers by automating tests using the infrastructure of webpagetest.org, and summarizing both the results visually and numerically in one place.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1NWhWuNJ3uph9V9GZVw1aW/be579629678a74e01792f6c6c6f56330/image4-2.png" />
          </figure><p>The visualization gives you a clear idea of what customers are going to see when they come to your site, and the <i>Critical Loading Times</i> provide the most important metrics to judge your performance. On top of seeing your site’s performance, we provide a list of recommendations for ways to even further increase your performance. If you are using WordPress, then we will test your site with Automatic Platform Optimizations to estimate the benefit you will get with the service.</p>
    <div>
      <h3>The Benefits of Automatic Platform Optimization</h3>
      <a href="#the-benefits-of-automatic-platform-optimization">
        
      </a>
    </div>
    <p>We tested APO on over 500 Cloudflare customer websites that run on WordPress to understand what the performance improvements would be. The results speak for themselves:</p><p><b>Test Results</b></p>
<table><thead>
  <tr>
    <th><span>Metric</span></th>
    <th><span>Percentiles</span></th>
    <th><span>Baseline Cloudflare</span></th>
    <th><span>APO Enabled</span></th>
    <th><span>Improvement (%)</span></th>
  </tr></thead>
<tbody>
  <tr>
    <td><span>Time to First Byte (TTFB)</span></td>
    <td>90th</td>
    <td>1252 ms</td>
    <td>351 ms</td>
    <td>71.96%</td>
  </tr>
  <tr>
    <td>10th</td>
    <td>254 ms</td>
    <td>261 ms</td>
    <td>-2.76%</td>
  </tr>
  <tr>
    <td><a href="http://web.archive.org/web/20210503002739/https://web.dev/fcp/"><span>First Contentful Paint</span></a><br /><span>(FCP)</span></td>
    <td><span>90th</span></td>
    <td>2655 ms</td>
    <td>2056 ms</td>
    <td>22.55%</td>
  </tr>
  <tr>
    <td><span>10th</span></td>
    <td>894 ms</td>
    <td>783 ms</td>
    <td>12.46%</td>
  </tr>
  <tr>
    <td><a href="http://web.archive.org/web/20210503002739/https://web.dev/speed-index/"><span>Speed Index</span></a><br /><span>(SI)</span></td>
    <td><span>90th</span></td>
    <td>6428</td>
    <td>5586</td>
    <td>13.11%</td>
  </tr>
  <tr>
    <td><span>10th</span></td>
    <td>1301</td>
    <td>1242</td>
    <td>4.52%</td>
  </tr>
</tbody></table><p>Note: Results are based on test results of 505 randomly selected websites that are cached by Cloudflare. Tests were run using WebPageTest from South Carolina, USA and the following environment: Chrome, Cable connection speed.</p><p>Most importantly, with APO, a site’s TTFB is made both fast and consistent. Because we now serve the HTML from Cloudflare’s edge with 0 origin processing time, getting the first byte to the eyeball is consistently fast. Under heavy load, a WordPress origin can suffer delays in building the HTML and returning it to visitors. APO removes the variance due to load resulting in consistent TTFB &lt;400 ms.</p><p>Additionally, between faster TTFB and additional caching of third party fonts, we see performance improvements in both FCP and SI for both the fastest and slowest of the sites we tested. Some of this comes naturally from reducing the TTFB, since every millisecond you shave off of TTFB is a potential millisecond gain for other metrics. Caching additional third party fonts allows us to reduce the time it takes to fetch that content. Given fonts can often block paints due to text rendering, this improves the rate at which the page paints, and improves the Speed Index.</p><p>We asked the folks at <a href="https://kinsta.com/">Kinsta</a> to try out APO, given their expertise on WordPress, and tell us what they think. <a href="https://brianli.com/">Brian Li</a>, a Website Content Manager at Kinsta, ran a set of tests from around the world on a website hosted in Tokyo. I’ll let him explain what they did and the results:</p><blockquote><p>At Kinsta, <a href="https://kinsta.com/blog/fastest-wordpress-hosting/">WordPress performance</a> is something that’s near and dear to our hearts. So, when Cloudflare reached out about testing their new Automatic Platform Optimization (APO) service for WordPress, we were all ears.
 
This is what we did to test out the new service:</p></blockquote><ol><li><p>We set up a test site in Tokyo, Japan – one of the 24 high-performance <a href="https://kinsta.com/knowledgebase/google-cloud-data-center-locations/">data center locations</a> available for Kinsta customers.</p></li><li><p>We ran several speed tests from six different locations around the world with and without Cloudflare’s APO.</p></li></ol><blockquote><p>The results were incredible!
 
By caching <a href="https://kinsta.com/blog/wordpress-vs-static-html/">static HTML</a> on Cloudflare’s edge network, we saw a 70-300% performance increase. As expected, the testing locations furthest away from Tokyo saw the biggest reduction in <a href="https://kinsta.com/blog/ttfb/">load time</a>.
 
If your WordPress site uses a traditional <a href="https://www.cloudflare.com/learning/cdn/what-is-a-cdn/">CDN</a> that only caches CSS, JS, and images, upgrading to Cloudflare’s WordPress APO is a no-brainer and will help you stay competitive with modern Jamstack and static sites that live on the edge by default.</p></blockquote><p>Brian’s test results are summarized in this image:</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6gDzHYWY75hKTwwHOoi6Xz/17e3e423683f032d12d22407bccf74a2/image1-7.png" />
          </figure><p><sub>Page Load Speeds for loading a website hosted in Tokyo from 6 locations worldwide - comparing Kinsta, Kinsta with KeyCDN, and Kinsta with Cloudflare APO.</sub></p><p>One of the clear benefits, from Kinsta’s testing of APO, is the consistency of performance for serving your site no matter where your visitors are in the world. The consistent sub-second performance shown with APO versus two or three second load times in other setups makes it clear that if you have a global customer base, APO delivers an improved experience for all visitors.</p>
    <div>
      <h3>How Automatic Platform Optimization Works</h3>
      <a href="#how-automatic-platform-optimization-works">
        
      </a>
    </div>
    <p>Automatic Platform Optimization is the result of being able to use the power of <a href="https://www.cloudflare.com/developer-platform/workers/">Cloudflare Workers</a> to intelligently cache dynamic content. By caching dynamic content, we can serve the entire website from our edge network. Think ‘static site’ but without any of the work of having to build or maintain a static site. Customers can keep managing and updating content on their website in the same way and leave the hard work for performance to us. Serving both static and dynamic content from our network results, generally, in no origin requests or origin processing time. This means all the communication occurs between the user’s device and our edge. Reducing the multitude of round trips typically required from our edge to the origin for dynamic content is what makes this service so effective. Let’s first see what it normally looks like to load a WordPress site for a visitor.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/nNaWWkM0X15Pp0jwnO0Hc/3c3b17b0325638bdb93e844654f2b92b/image3-3.png" />
          </figure><p><sub>A sequence diagram for a typical user visiting a site‌‌</sub></p><p>In a regular request flow, Cloudflare is able to cache some of the content like images, CSS, or JS, while other requests go to either the origin or a third party service in order to fetch the content. Most importantly the first request to fetch the HTML for the site needs to go to the origin which is a typical cause of long TTFB, since no other requests get made until the client can receive the HTML and parse it to make subsequent requests.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/rbLsPASTNRFCNN5E1ySpm/edc2cc24486bc03730ebf0980654c834/image2-2.png" />
          </figure><p><sub>The same site visit but with APO enabled.</sub></p><p>Once APO is enabled, all those trips to the origin are removed. TTFB benefits greatly because the first hop starts and ends at Cloudflare’s network. This also means the browser starts working on fetching and painting the webpage sooner meaning each paint event occurs earlier. Last by caching third party fonts, we remove additional requests that would need to leave Cloudflare’s network and extend the time to display text to the user. Often, websites use fonts hosted on third-party domains. While this saves bandwidth costs that would be incurred from hosting it on the origin, depending on where those fonts are hosted, it can still be a costly operation to fetch them. By rehosting the fonts and serving them from our cache, we can reduce one of the remaining costly round trips.</p><p>With APO for WordPress, you can say bye bye to database congestion or unwieldy plugins slowing down your customers’ experience. These benefits are stacked on top of our already fast <a href="https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/">TLS connection times</a> and industry leading protocol support like HTTP/2 that ensure we are using the most efficient and the fastest way to connect and deliver your website to your customers.</p><p>For customers with WordPress sites that support authenticated sessions, you do not have to worry about us caching content from authenticated users and serving it to others. We bypass the cache on standard WordPress and WooCommerce cookies for authenticated users. This ensures customized content for a specific user is only visible to that user. While this has been available to customers with our Business-level service, it is now available for any WordPress customer that enables APO.</p><p>You might be wondering: “This all sounds great, but what about when I change content on my site?” Because this service works in tandem with our <a href="https://www.cloudflare.com/integrations/wordpress/">WordPress plugin</a>, we are able to understand when you make changes and ensure we quickly purge the content in Cloudflare’s edge and refresh it with the new content. With the plugin installed, we detect content changes and update our edge network worldwide with automatic cache purges. As part of this release, we have updated our WordPress plugin, so whether you use APO, you should upgrade to the latest version today. If you do not or cannot use our WordPress plugin, then APO will still provide the same performance benefits, but may serve stale content for up to 30 minutes and when the content is requested again.</p><p>This service was built on the prototype work originally blogged about <a href="https://blog.cloudflare.com/improving-html-time-to-first-byte/">here</a> and <a href="https://blog.cloudflare.com/fast-google-fonts-with-cloudflare-workers/">here</a>. For a more in depth look at the technical side of the service and how Cloudflare Workers allowed us to build the Automatic Platform Optimization service, see the <a href="https://blog.cloudflare.com/building-automatic-platform-optimization-for-wordpress-using-cloudflare-workers/">accompanying blog post</a>.</p>
    <div>
      <h3>WordPress Today, Other Platforms Coming Soon</h3>
      <a href="#wordpress-today-other-platforms-coming-soon">
        
      </a>
    </div>
    <p>While today’s announcement is focused on supporting WordPress, this is just the start. We plan to bring these same capabilities to other popular platforms used for web hosting. If you operate a platform and are interested in how we may be able to work together to improve things for all your customers, <a href="https://www.cloudflare.com/partners/">please get in touch</a>. If you are running a website, let us know what platform you want to see us bring Automatic Platform Optimization to next.</p> ]]></content:encoded>
            <category><![CDATA[Birthday Week]]></category>
            <category><![CDATA[WordPress]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[TTFB]]></category>
            <category><![CDATA[Automatic Platform Optimization]]></category>
            <guid isPermaLink="false">wrkP5f4p5fxKa7hQACHv6</guid>
            <dc:creator>Garrett Galow</dc:creator>
        </item>
    </channel>
</rss>