Cache based on query string values

Hi,

there is a way to choose cache ttl to apply based on one or more query string presence / values?

As an example:

Example Domain → I would like to cache for 5 seconds

Example Domain → I don’t want to cache at all

I can match in the url segment but I can only use * as wildcard, no regex allowed,right?

Thanks in advance,
Riccardo

Only Enterprise plans can set Edge Cache that low. And I haven’t seen a way to get a page rule to match a query string. It’s possible a Worker can do this, but even then, I don’t know if it can set TTL that low unless you’re an Enterprise customer. Maybe @cbrandt knows how low you can set Edge Cache in a Worker.

No, I’m afraid not. I’d just suggest the OP edit his topic to move it to category Workers, where perhaps his issue may have a greater chance of attracting a solution. Also, Option 2 in the below doc may offer a hint as how such a Worker could be written:

https://support.cloudflare.com/hc/en-us/articles/360023040812-Best-Practice-Caching-Everything-While-Ignoring-Query-Strings

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.