APO and Query String Cache


I have just started testing out APO and it seems very promising. But I do have a few issues and questions.

I am guessing APO bypasses the cache for query strings, the natural thing to do. Facebook traffic often comes with a query string and parameters (fbclid), as Google News and other types of traffic (utm, gclid). I opened a CloudFlare support ticket about this a while ago (https://bit.ly/3ixgKuG).

Since I get a ton of traffic with query strings, I need to cache these requests, so I deployed a Worker that detects and caches those specific query strings. Unfortunately, it seems like the Worker is being bypassed by APO since requests made with fbclid and other query strings are returning cf-cache-status: DYNAMIC. Removing the query string from the URL returns cf-cache-status: HIT.

  1. Is there any way to customize query string caching with APO? If not, I think this would be a very useful feature to have.

  2. Can Workers work together with APO? If not, this would also be very useful.

  3. Is there anything that can be done to get those query strings cached while using APO? I don’t want to use a Page Rule with a 301 redirect (that was the point of using a Worker).

Thank you.


Actually WP APO doesn’t bypass query string cache exactly. What it does is in 1st request it does a 302 redirect to the url with query string stripped and serves the 302 redirect target via cache if available. But there is no browser level caching in WP APO. So the 302 redirect target will always be served from CF CDN cache even on repeat visits. I posted a benchmark test writeup on WP APO’s cache effectiveness for repeat visitors on my forums at https://community.centminmod.com/threads/cloudflare-automatic-platform-optimization-for-wordpress-cache-effectiveness.20494/

edit: actually I think 302 redirect is something I setup on my origin Nginx configuration. Here’s results without the 302 redirect for WP APO https://community.centminmod.com/threads/cloudflare-automatic-platform-optimization-for-wordpress-cache-effectiveness.20494/#post-86482

Pretty sure Cloudflare folks can do this as I did it with my own CF Worker caching to include query strings in caching @yevgen ?

Thanks for your input @eva2000.

As I suspected, APO seems to ignore query strings, which is totally normal in a normal setup. But I think it would ve very important to have an option to enable caching of defined query strings. Otherwise, APO will never cache most of the traffic coming from social media and it will never match the performance we get from using a normal Worker to cache everything.

And I believe having Workers working with APO would also be an important feature, although I might not even need to use Workers anymore if APO can cache query strings. But one might still need Workers for different reasons.

Unfortunately, the current state of APO makes it unusable for me and I had to revert back to my own custom Worker caching system for the time being.

Hey @eva2000, were you able to get this Worker working with APO? If so, how?

My Worker seems to be ignored by APO.

WP APO plugin doesn’t expose the CF Worker AFAIK, so only CF folks would be able to make those changes

Ah, so my assumptions were right then. Workers don’t work with APO.

Thanks for the info!

Monday bump.

We are looking into the list of the marketing query strings which are safe to ignore and return cached content. I don’t have an ETA for this feature request, it seems a valid case to support, most probably will be added to APO eventually.

1 Like

Here’s the list of query strings I include in my Cache Enabler full HTML page cache article at https://servermanager.guide/203/wordpress-cache-enabler-advanced-full-page-caching-guide/

regex is


or you can do custom cache key to include query string and make a per cache with query string inclusion?


Thanks for the info. Hopefully, the feature will be added sooner than later.

Hi @yevgen,

I saw that your team fixed some outstanding issues with APO. That’s awesome!

I was wondering if you had an update regarding APO and query string cache?

This is a feature that I (and I’m sure many others) are looking forward to.

Thank you.

should go live early next week, will support all the query strings from the list:

1 Like

That’s awesome! Can’t wait to test it out.

Please let me know once you’ve deployed the changes so I can provide some feedback.


It is live now.


Great! I will be testing it out today.

Thank you.

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