How to bypass CDN for a specific country?

Hello, I hope you are fine. Is there a way to bypass CDN for my users of a specific country? For example, when you are from Germany, you should connect directly to the server. Otherwise, you will connect to my site from Cloudflare.

Sorry, but DNS for a hostname is global. Is there a reason you want to go direct while in Germany?


No, Actually I live in Iran and Unfortunetly, our internet is based on the national network like the Great firewall in china and if my Iranian visitors connect directly they will have better and cheaper connection. In our country domestic traffic is cheaper by half.

در تاریخ جمعه ۲۸ مهٔ ۲۰۲۱،‏ ۲۱:۲۱ sdayman via Cloudflare Community <[email protected]> نوشت:

1 Like

There isn’t a way to face the challenge, is there?

Is it possible for you to host the website in another subdomain just for Iranian visitors (e.g. and then use DNS only mode :grey: for the specific subdomain?

So you can create a Workers script to redirect Iranian visitors to this subdomain if they access (global version of the website which is :orange:.)


Yeah, It’s a good idea. Thanks a lot.

1 Like

That should take care of 90% of the problem. As long as their “great firewall” doesn’t block the initial request to the :orange: hostname, it’ll work.

It’s even quite possible that a local .htaccess file could look at the CF Country header and do the redirect:

1 Like

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