Subscribe to receive notifications of new posts:

Caching Anonymous Page Views

12/12/2016

3 min read

UK Smart Motorway M42 Smart Motorway in the West Midlands, UK; courtesy of Highways England.

The load time of your website not only affects your search engine rankings, but is also correlated to the conversion rate on your site:

  • Walmart.com found that for every 1 second of page speed improvement, they experienced a 2% increase in conversion rate.
  • Greg Linden's presentation Make Data Useful demonstrated through A/B Testing every 100ms in page load time delays led to a 1% loss of sales for Amazon.
  • Kyle Rush from the 2011 Obama for America campaign site showed a 3 second page load speed improvement increased on-site donations by 14% (resulting in over $34 million in donations).

Cloudflare is determined to help website administrators boost the performance of their websites. From today, Cloudflare users on our Business plan will gain a previously Enterprise-only Page Rule option, “Bypass Cache on Cookie”. When used in conjunction with a “Cache Everything” Page Rule, this setting allows for websites to cache the HTML of anonymous page visits without affecting dynamic content.

By caching anonymous page views, Cloudflare is able to help ensure that your origin webserver doesn't waste time constantly regenerating pages which change rarely. This ultimately allows us to reduce load on your server and reduce load times when users reach your site.

Caching HTML

Bypass Cache on Cookie Page Rule Configuration

Cloudflare automatically caches static resources such as JavaScript, CSS and Images. Additionally, it is possible on all plans to instruct Cloudflare to cache static HTML using a “Cache Everything” Page Rule.

With static HTML, it is easy to work out what should and should not be cached - the response is exactly the same from request-to-request. However, this gets more complicated when you put a login form and a shopping cart into the mix. Once the user logs-in or adds a product to their shopping cart, the HTML being rendered is then personalised to them.

As HTTP is a stateless protocol; in order for a web application to determine which users need dynamic content, cookies are used. When the “Bypass Cache on Cookie” rule is matched, Cloudflare will bypass the “Cache Everything” rule and fetch HTML from the origin. Where a cookie is not set, Cloudflare abide by the "Cache Everything" rule and will seek to cache the static HTML for a given request.

Our Bypass Cache on Cookie setting allows for wildcard (“.*”) operators and OR pipe operators (“|”). Additionally, you are able to customise the cache TTL on our servers using the “Edge Cache TTL” option in Page Rule settings.

When your anonymous page views change, you can purge the cache using our web interface, our API or our platform integrations.

We have a number of tutorials on our Knowledge Base on how you can set this up with a variety of platforms:

Want to go further? This setting can be used in conjunction with the Railgun web optimizer, which can speed up the delivery of dynamic content that cannot be cached.

Above this, Cloudflare’s Enterprise users have the option of taking their caching to the next level by using our Custom Cache Key functionality alongside other Page Rule options such as “Cache by Device Type” or “Cache on Cookie”.

We protect entire corporate networks, help customers build Internet-scale applications efficiently, accelerate any website or Internet application, ward off DDoS attacks, keep hackers at bay, and can help you on your journey to Zero Trust.

Visit 1.1.1.1 from any device to get started with our free app that makes your Internet faster and safer.

To learn more about our mission to help build a better Internet, start here. If you're looking for a new career direction, check out our open positions.
Page RulesRailgunSpeed & ReliabilityCache

Follow on X

Junade Ali|@IcyApril
Cloudflare|@cloudflare

Related posts