How to bypass cache based on region?

Hi,
I want to bypass the cache for some visiters from specific country(according to their ip address), I am using free plan, how should I set it up?
Thanks in advance.

Hi,

Unfortunately Cache Rules do not seem to accept Country as a matching pattern. However, you can create a Transform Rule to accomplish what you want, since the TR triggers before the CR. Keep in mind that IP information is based on real-time data and may not be 100% accurate all the time as far as location goes.

A Transform Rule to Rewrite the query string.

When incoming requests match...
Country equals United States (example)
Path: Preserve
Query: Static "country=US"

Then a Cache Rule (beta)

When incoming requests match...
Query String equals "country=US"
Bypass Cache

Please note that this will remove any pre-existing query string coming with the requested URL. To avoid that, you need to familiarize yourself with the Rules logic and use the concat() function to append one query string to another.

1 Like

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