PageSpeed Insights is always bypassing APO HTML cache

Hello,
First, thanks for releasing the APO for Wordpress!
This is a killer feature :slight_smile:

I do experience a huge benefit with my browser.
But I am having a hard time to measure it with Google’s PageSpeed Insights.
I am testing the homepage of our staging Wordpress: https://wisepops.tech

It appears that the request issued by PageSpeed always reach our origin server.
I can’t understand why, since the request:

  • does not contain the header Cache-Control: no-cache
  • does not query an URL with search params.
  • does not contain any Wordpress related cookie

Here is an example of request from PageSpeed Insights that hit our server:

URI: /
HOST: wisepops.tech
CONNECTION: Keep-Alive
ACCEPT-ENCODING: gzip
CF-IPCOUNTRY: XX
X-FORWARDED-FOR: 66.249.93.123
CF-RAY: 5e6adae626bfdc2b-LHR
X-FORWARDED-PROTO: https
CF-VISITOR: {"scheme":"https"}
CF-EW-VIA: 15
CDN-LOOP: cloudflare; subreqs=1
ACCEPT-LANGUAGE: en-US
ACCEPT: */*
COOKIE: __cfduid=...; __atuvc=...; __atuvs=...; ajs_anonymous_id=...; _ga=...; _gid=...; _gat_UA-41461849-2=...; wisepops=...; wisepops_props=...; wisepops_visits=...; wisepops_session=...; _cio=...; __hstc=...; hubspotutk=...; __hssrc=...; __hssc=...; wisp-https%3A%2F%2Fapp.getwisp.co-7W=...; intercom-id-l4ewd6zv=...; intercom-session-l4ewd6zv=...
USER-AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Safari/537.36 Chrome-Lighthouse
CF-CONNECTING-IP: 66.249.93.123
CF-REQUEST-ID: 05f6a723d50000dc2b98a41000000001

Our origin server keeps receiving such requests when repeating the PageSpeed analyze.
The CF-CONNECTING-IP slightly changes, but the end of CF-RAY is always LHR.
So my question is, why PageSpeed Insights always bypass the Cloudflare HTML cache?
Many thanks!

@yevgen might have a better idea but from I can see it’s due to Accept */* header. CF APO only caches for Accept text/html requests AFAIK

You can use webpagetest.org’s Google Lighthouse testing instead and see if it tests correctly - I wrote a guide at https://community.centminmod.com/threads/how-to-use-webpagetest-org-for-page-load-speed-testing.13859/

example of 3 run average where summary median is run 3 https://www.webpagetest.org/result/201023_Di45_f5292fe504766d75511b5f4b2f2dcd0d/

run 3 median https://www.webpagetest.org/result/201023_Di45_f5292fe504766d75511b5f4b2f2dcd0d/3/details/#waterfall_view_step1

TTFB for request 1 index HTML page = 95ms

request header with Accept text/html

response headers with cf-apo-via: cache and cf-edge-cache: cache,platform=wordpress and cf-cache-status: HIT

and Google Lighthouse at https://www.webpagetest.org/lighthouse.php?test=201023_Di45_f5292fe504766d75511b5f4b2f2dcd0d&run=3

1 Like

Thank you @eva2000!
This will help me a lot.

1 Like

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

We may whitelist APO for Google Lighthouse testing, I remember it was a popular ask for Rocket Loader as well. Stay tuned.

3 Likes

Google Page Insights should test pages with APO (if enabled) as of now.

1 Like