Bypass proxy for epesific country

What is the name of the domain?

What is the issue you’re encountering

Proxy

I am afraid this is currently not possible and cannot be done yet. It’s either proxied :orange: or unproxied :grey: DNS for all. Cloudflare’s DNS settings don’t allow for conditional proxying (or “unproxying”) based on country.

You could, create e.g. sub-domain visitorsCountryA.example.com and visitorsCountryB.example.com, both unproxied and set to :grey: (DNS-only), and then on the example.com which is proxied and set to :orange:, using a Worker code you could redirect the traffic based on specific country to such unproxied :grey: hostname.

Worker code:

addEventListener('fetch', event => {
  const country = event.request.headers.get('CF-IPCountry');
  
  // Check if the request is coming from Croatia (country code 'HR')
  if (country === 'HR') {
    // Redirect to a different URL, bypassing Cloudflare for users in Croatia
    const redirectUrl = 'https://hr.example.com'; // URL to redirect to
    const response = Response.redirect(redirectUrl, 301); // 301 is permanent redirect
    event.respondWith(response);
  } else {
    // Otherwise, let the request go through Cloudflare as usual to exmple.com
    event.respondWith(fetch(event.request));
  }
});

if so, please make sure the IP Geolocation feature is enabled in your Cloudflare dashboard under the Network tab for your zone as follows on the article from below: