WordPress Automatic Platform Optimization cache html with query strings

Hi,

I am using WordPress Automatic Platform Optimization, and it works perfectly for URLs without a query string like https://www.domain.com/random/. These pages get cached and served to users which are not logged in.

For URL’s like https://www.domain.com/random/?sort=192 I get bypassed and sent to the origin server. headers:
cf-apo-via:origin,qs
cf-cache-status:BYPASS

Is it possible to cache those pages as well?

They’d have to hardcode that query string in to stop it from being bypassed. Given that it’s “sort”, I don’t think that’s a safe one to cache for all APO users.

https://developers.cloudflare.com/automatic-platform-optimization/reference/query-parameters/

1 Like

Thx for the quick reply. Just to be sure I fully understand… If I would use one of the query parameters in your url like “ref” In my example (https://www.domain.com/random/?ref=192), would Cloudflare serve a cached version of https://www.domain.com/random/?ref=192 or https://www.domain.com/random/
?

1 Like

That sounds like a clever workaround. Give it a try and let us know how it goes.

did not work :frowning:
Cloudflare cached:
https://www.domain.com/random/?ref=
instead of
https://www.domain.com/random/?ref=192

What’s your Cache Level set to?

https://developers.cloudflare.com/cache/how-to/set-caching-levels/

https://developers.cloudflare.com/automatic-platform-optimization/reference/page-rule-integration/

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