APO woocommerce query strings and cookies


I’m considering using APO for wordpress and have a few questions:

  1. Is it possible to cache pages with query params? Is it possible to to control which query params affect the cache?
  2. Is it possible to control which cookies bypass cache?


For Wordpress CF APO there is no end user control for cookies or query params or URL path cache exclusions. You’re at the mercy of whatever Cloudflare configures for them at the moment. You can read and bookmark https://support.cloudflare.com/hc/en-us/articles/360049822312 which lists current query strings that are cached as well as which Wordpress plugins are compatible/not compatible.

FYI, there no plans to add UI support for allowing users to add URLs to exclude from APO caching. Instead, users will need to add code to Wordpress to serve a specific header for the page/url you do not want APO to cache outlined in linked thread

We are working to support APO integration with Page rules:

  • bypass on cookies to support custom cookies (Biz plan)
  • cache level bypass to bypass specific pages in APO
  • edge caching TTL to shorten default TTL for specific pages in APO
1 Like

Ah so moving that cache control from Wordpress plugin to CF page rules instead :slight_smile:

Can I use cloudflare for my woocommerce without the APO intergration to have control of the cache?
What does APO give in addition the cloudflare’s regular page level cache offering?

Difference is outlined at https://blog.cloudflare.com/automatic-platform-optimizations-starting-with-wordpress/ and https://blog.cloudflare.com/building-automatic-platform-optimization-for-wordpress-using-cloudflare-workers/ - mainly in how cache invalidation and cache misses are handled differently in CF APO due to utilising CF Worker KV

Updating content

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.

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).

You can use Cloudflare to cache static assets css/js/images for Woocommerce and other web apps and do for guest non-logged in user caching with CF business plan’s bypass cache on cookie page rules but any requests i.e. carts for logged in members with cookies will bypass CF caching See https://support.cloudflare.com/hc/en-us/articles/236166048-Caching-Static-HTML-with-WordPress-WooCommerce

Cloudflare Enterprise plan users can go further with custom cache keys https://support.cloudflare.com/hc/en-us/articles/115004290387-Creating-Cache-Keys

1 Like

yes, we want to leverage existing mechanisms as much as possible.

1 Like

maybe add page rule permission optionally to Wordpress API token and allow the Wordpress plugin to actually create the CF page rule(s) needed?

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.