Our WordPress website uses the following cache:
- OPCache
- Redis Object Cache.
- WP Rocket
- Nginx
- Cloudflare
From time to time, we will see some pages become blank. Even after I open a new Incognito window in Chrome and visit that page, we will still get a blank page. However, if we press Ctrl + F5, or use FireFox to open that page, then the page content will be loaded properly.
Since Ctrl + F5 is bypass cache and reload the page, we want to find out which level of Cache cached the blank page and want to prevent that.
Currently we have already set the following headers on blank pages:
header('Cache-Control: no-cache, must-revalidate, max-age=0', true);
header('CDN-Cache-Control: no-cache, must-revalidate, max-age=0', true);
header('Cloudflare-CDN-Cache-Control: no-cache, must-revalidate, max-age=0', true);
But it seems does not work. Below is a response header in Chrome DevTools:
1. alt-svc:
h3=":443"; ma=86400
2. cache-control:
no-cache, must-revalidate, max-age=0, max-age=2592000
3. cdn-cache-control:
no-cache, must-revalidate, max-age=0
4. cdn-cache-control:
max-age=1209600
5. cf-apo-via:
origin,miss
6. cf-cache-status:
EXPIRED
7. cf-ray:
832d0ade4a49eebc-ATH
8. content-encoding:
br
9. content-type:
text/html; charset=UTF-8
10. date:
Sat, 09 Dec 2023 11:52:31 GMT
11. expires:
Mon, 08 Jan 2024 10:35:45 GMT
12. last-modified:
Sat, 09 Dec 2023 10:59:16 GMT
13. nel:
{"success_fraction":0,"report_to":"cf-nel","max_age":604800}
14. referrer-policy:
no-referrer, strict-origin-when-cross-origin
15. report-to:
{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=sUbhALNx1hjiXmzm0XnuNkvrr0mXCPJjdaL%2FDJjYk%2BEefJR2%2BoRk5%2FlrlBgLQnNMiV%2FmemhFD1h1U0yQAlJ6UuJGAQ6XGgczgDTydENvqCGRxyDGfiLudNnVLMPoZybfQqoEtx%2FHHEcFX%2FflSGLu"}],"group":"cf-nel","max_age":604800}
16. server:
cloudflare
17. strict-transport-security:
max-age=63072000
18. vary:
Accept-Encoding
19. x-content-type-options:
nosniff
20. x-frame-options:
SAMEORIGIN
21. x-proxy-cache:
HIT
22. x-xss-protection:
1; mode=block