Caching Static HTML with WordPress/WooCommerce

Customers in all Cloudflare plans can configure caching HTML files. However, only customers in the Business and Enterprise plans are able to bypass HTML caching whenever a cookie is sent with a request (Bypass Cache on Cookie setting in Create Page Rules).

Cloudflare Business and Enterprise plan customers are able to cache anonymous page views when using WordPress using our Bypass Cache on Cookie functionality. This allows for static HTML to be cached at our edge, with no need for it to be regenerated from request to request. This tutorial will help you set this up with WordPress and WooCommerce.

Enterprise Cloudflare customers can use Custom Cache Keys to take their performance further, contact your Customer Success Manager for more details.

Before starting - be sure that Cloudflare is set to respect Cache-Control headers from your origin web server; otherwise, you may find Cache-Control headers are overridden by Cloudflare with the value set in the Browser Cache Expiration option. In order to set the Respect Existing Headers option, visit the Caching app in the Cloudflare dashboard:

Scroll down the page to find the Browser Cache Expiration option, and select the Respect Existing Headers value:

Once this is done, set the Bypass Cache on Cookie rule. You can do this in the Page Rules app in the Cloudflare dashboard:

Finally, setting Edge Cache TTL will define the maximum period of time Cloudflare should keep cached files before getting them back from the origin web server. Even after setting a long Edge Cache TTL time, you can still manually clear the cache or use our WordPress plugin to automatically manage cache purging.