Bypassing CF DNS for specific countries


My host’s server is in Singapore.

Without CF, the server response time for visitors from Singapore & India is very good (below 100ms).
WIth CF on, the server response time is significantly higher.
However, with CF on, I get better response time for visitors from North America/Europe.

Is there any way to have CF provide DNS/cache service to North America/Europe,
but use original host’s IP when the visitor is from Singapore/India?


No way that I can think of.


Do you know what would be the best setup so that visitors from India/Singapore get better response time, and at the same time - visitors from other continents do as well?

You could serve your site out on two different ‘vhosts’ - i.e. have it served on both and on (for Singapore), say. Then have the www subdomain proxied by Cloudflare (orange cloud) and the sg subdomain direct (grey cloud).

You’d need to set up a redirect on your web server so that visitors from Singapore are sent to their dedicated subdomain, but that’s easily done as Cloudflare pass you a geolocation header - CF-IPCountry.

So now your server set up is to listen on both and and have a little redirect that checks if CF-IPCountry == “SG” in your server config (.htaccess, say).

Repeat this for India, too.

The first hit on the site would still have a little delay being routed via Cloudflare but once that initial redirect was done, you’d be fine.

Obviously if Singapore/India is your main audience, flip it around and have them served on and international visitors on, whatever makes more sense.

1 Like

Hi Saul,
Really appreciate your suggestion. Very good solution.
My only concern is that I would like visitors from Singapore/India to share the same url to a page that others in North America would do.
From the solution above, it appears different people from would end up sharing different urls.

Yeah, there’s no easy way around that really. is going to have to either resolve to the Cloudflare IPs in which case you’re using them, or your real backend IPs to bypass them, you can’t really return both.

However if your redirect contains the request path there’s not really any problem having move a user over to from a technical standpoint. You can still brand as etc. and traffic will still hit the correct page after the redirect.

I mean if it’s good enough for Google (when I type I get put on in the UK and in Australia but I still know them and refer to them only as then I’d be happy with it.

But yes, it’s not perfect.

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