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
Chaika
Chaika•14mo ago
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?
quisi.do
quisi.do•14mo ago
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.
Chaika
Chaika•14mo ago
Yea, you need to enable Cloudflare Proxy Cloudflare on the DNS Record for any of those settings to work. Otherwise it's not passing through Cloudflare's CDN/Proxy at all
Chaika
Chaika•14mo ago
Looks good now, Static:
Chaika
Chaika•14mo ago
Not Static:
quisi.do
quisi.do•14mo ago
Thank you. What a silly mistake.
Chaika
Chaika•14mo ago
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