How can I test a cache rule?
I have a cache rule that all URIs that start with
/static/
and have a 2xx response code should have a 1 year cache. However, despite purging my cache, I am receiving a Cache-Control: max-age=600
header instead of the expected 1 year.
I'm unsure if it's as simple as the URI path match being inaccurate, but I have no way of testing that the expected paths match.
The origin is hosted on GitHub Pages, where max-age=600
is the origin's Cache-Control
header.7 Replies
That rule looks ok. If you're ever confused if a expression is matching, you can use Transform Rules Response Headers Rewrite with the same expression and set match=1 or something, and see if it matches (you could also use transform rules to set Cache-Control itself for browsers to use if you wanted to).
Is the dns record proxied? What's the link to the site?
The website is https://charlesstover.com/.
The proxy status is DNS only. 😵 Mayhaps that is may mistake. I didn'trealize that was the setting, and I'm not honestly sure why it is configured that way.
Yea, you need to enable Cloudflare Proxy on the DNS Record for any of those settings to work. Otherwise it's not passing through Cloudflare's CDN/Proxy at all
Looks good now,
Static:
Not Static:
Thank you. What a silly mistake.
No worries, happy to help! Cloudflare has its own alterative to Github pages, Cloudflare Pages. It handles caching on the edge for you and such, maybe some day worth looking into