AMP pages version is never cached by Automatic Platform Optimization for Wordpress


I am not able to make Automatic Platform Optimization for Wordpress to cache HTML pages in AMP version.
No page rules active.

Here you can find an example (multiple tests performed with

Standard version

Response headers

cf-cache-status: HIT
x-via: speedwp/cache
cf-edge-cache: cache,platform=wordpress

AMP version

Response headers

cf-cache-status: DYNAMIC
x-via: speedwp/origin,qs
cf-edge-cache: cache,platform=wordpress

What should I do to make HTML edge caching to work also for AMP pages?


To figure out the issue, you need to look at the parameters of the x-via header for the AMP pages. In your case, this is what you are getting: x-via: speedwp/origin,qs

Essentially, the x-via header tells you that you are using APO (speedwp), but that the content was NOT cached and returned from your web server (origin) because it has a query string (qs). In your case, the query string is ?amp= at the end of the URL. Right now, I believe APO is NOT caching pages with an ?amp query string. It will only cache AMP pages if they use the /amp/ slug.

I know @yevgen and his team have recently added some query strings to be safely ignored and cached by APO, and I think adding query strings for AMP pages would also make sense since not everyone uses the /amp/ slug. I know the developers of the Official AMP Plugin for WordPress are leaning towards an ?amp query string rather than the /amp/ slug, but discussion is still ongoing (

So for the time being, if you want to be able to cache AMP pages with an ?amp= query string, you could always setup a Page Rule with a Cache Level of Cache Everything and the following URL match:*?amp=

Hope this helps.


Thanks @janvitos

I’ll try your suggestion.

I think this is currently a huge limitation of Automatic Platform Optimization for Wordpress considering that I am using official AMP Plugin for WordPress that creates AMP pages exactly in the format of my example !

Now I applied a dedicated page rule, but I think the beahaviour is not exactly what is expected.

AMP Page (in the example before final = was wrong)

Response header

cf-cache-status: HIT
x-via: speedwp/origin,qs
cf-edge-cache: cache,platform=wordpress

As you can see I have still x-via: speedwp/origin,qs and not x-via: speedwp/cache.

That’s normal since the AMP pages are NOT being cached by APO, but by your Page Rule.

And you know your AMP pages are being cached property since you are getting the cf-cache-status: HIT header.

Thanks @janvitos for the research, we will add amp to the list of query strings we allow to return from Cache.


I would like to make it clear the result of this change. AMP plugins for WordPress make html pages AMP compliant. It means possibly serving amp pages for desktop and mobile clients. At the moment we serve all content from the single cache regardless of the form factor: desktop, mobile, tablet. We are considering separate cache for mobile clients.

Back to the change that will allow to serve “” from Cloudflare cache. It means depending on the AMP configuration on your site we may serve AMP pages where it wasn’t requested and non AMP pages where “?amp=” was present.


The change is live.

1 Like

Since this change we have noticed the exact thing you warned about, AMP pages are being cached and displayed on desktop pages (which is undesirable)

Is there somewhere I can configure this to undo this behaviour for our account? Vary on query string presence or something?

This change created a lot of confusion among customers, we are going to revert the change.


Thanks can you update the thread once done, or is there a changelog or something I can subscribe to?

I’ll post in the thread.

Latest update: the release is postponed till Tuesday. We are bundling the fix with other changes which require more delicate rollout.


The change is live, requests with ?amp= will bypass cache.


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