Hope to understand how rewrite and cache work together

What is the name of the domain?

doesn’t matter

What is the issue you’re encountering

Hello everyone, I’m new to using Cloudflare. I’ve noticed the rewrite rules, but I don’t quite understand how they work in conjunction with caching. Let me give an example to clarify my question: Suppose I configure a rule to rewrite all paths under /x/* to /index.html (ignoring cache expiration for now). Now, if I access /x/1, and /x/1 is successfully cached by Cloudflare, what happens if I then access /x/2? Will Cloudflare fetch from the origin server again? Additionally, if the cache for /index.html expires, does that mean the cache for all paths under /x/* will also expire? I’ve reviewed Cloudflare’s documentation, but I couldn’t find any specific explanation for this scenario. Did I miss something, or could someone provide clarification on how this works? Thank you in advance for your help!

It sounds like they all point to the same path on the server. In that case, they should all be the same cached resource, so they’d all get a HIT once the first one does, and then expire at the same time (again, because they’re all the same resource).

1 Like

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