APO needs to cache AMP

One important missing compatibility is with AMP. The official WordPress AMP plugin doesn’t seem like cached by APO. I have tried everything but the URLs with ?amp parameters are always on BYPASS. The CF docs say that this parameter would be ignored, but it doesn’t seem so.

Anyone knows how to get it working for AMP pages?

AMP URLs are cached at the Google end.

You can cache your /amp/ URLs using some WordPress plugins like W3 Total Cache.

Regarding Cloudflare APO, you can try out using a Page Rule.

I am not sure about using ?amp. Can you try /amp/ instad?

Moreover, have the Real AMP URL enabled at Cloudflare dashboard (due to the HTTP Signed Exchanges).

In real world, AMP pages won’t always be served via Google CDN AMP cache as there are other platforms which can now auto detect AMP pages and serve them based on detected amphtml referenced AMP pages besides Google search. For example, Twitter on mobile Overview | Twitter Developer.

Twitter supports the standard AMP discovery mechanism. When a link is shared on Twitter, the Twitter crawler (user agent: Twitterbot/1.0) will look for a element in your document. If a valid AMP document is referenced, Twitter mobile clients will direct users to that AMP edition of your page.

So there are possibilities when AMP HTML pages aren’t cached outside of Google AMP cache.

Yeah using /amp instead of ?amp might help

1 Like

Thanks for the suggestions. Yes, the issue is Google is not the only AMP user now. Also, Google may use Core Web Vitals on uncached version of the AMP which is a ranking factor from May 2021.

I could probably programmatically find a way to change it to /amp/ but that’s not what the official plugin use, unfortunately. And won’t help others either. It’s used by over 500,000 users: AMP – WordPress plugin | WordPress.org

Hm, I am using the same official plugin since 2015 and having /amp/ end in my AMP URLs.

1 Like

True but it was used on “Reader” mode only (which is a basic view with non-real site design) on non-hierarchical posts.

Anyways, I did some digging and looks like the /amp/ URL option is also added few months ago (although they don’t recommend it): https://github.com/ampproject/amp-wp/pull/5558

1 Like

Hi @pacifier. Support of AMP ?amp requires dedicated cache similar to caching by device type. At this point we decided not to provide APO caching support of AMP pages. I’m planning to publish a blog post where I will explain the problem in more details.
The best way forward as was already suggested is to serve pages with /amp/ URL option in order to have APO caching support.

2 Likes

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

as promised, I delve into APO and AMP.

1 Like