How To Redirect Blocked Countries?

I have put the allowed countries in the firewall rule but now i want the blocked countries to be redirected to a url of my choice.

Is there a hero who can help?


1 Like

You can redirect countries from the Worker, but you must understand that the Worker is behind the Firewall.

client -> firewall -> worker -> origin server

If the request is blocked by the firewall it will not reach the Worker.

If your website doesn´t receive tons of traffic you could disable this firewall rule and use the following code: Country code redirect

The Worker will still be charged for every request (even redirects).

If your website receives a lot of traffic is better to use the Custom Pages (available in the Pro Plan), and set the redirect using client-side Javascript or meta refresh (<meta http-equiv="refresh" content="0;URL=''" /> ).

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