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:

https://www.example.com?qs=(1|0)&live=1 -> I would like to cache for 5 seconds

https://www.example.com?qs=1&live=0 -> 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 @floripare 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:

1 Like

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