Show Javascript Challange to everyone except 2 countries

Hello Sir,

My Question is about firewall rule, I want to show JavaScript challenge to all users except users for Two countries.

Can Anyone help me in doing it.

Thank You

Well I don’t know about using the firewall, but you could easily solve that using a worker.

All requests to workers have a cf object with info on the country of request.

Something like this:

addEventListener('fetch', event => {

async function checkCountry (event) {
  const country =;

  if (country === 'US') {
    return new Response.redirect('', 301);
  } else {
    return await fetch('');

Try this:


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