Simple testing for Country-based redirects?

Our netlify site name is "".

I’ve currently got a Country-specific redirect. IOW, this is in our netlify.toml:

from = "/"
to = "/en-gb/"
status = 302
force = true
conditions = { Country = ["gb"] }

Based on this page (Redirect options | Netlify Docs), I think that the ‘Country’ match is against GeoIP.

I want to write regression tests so that my web devs coming from the UK can fake being in various countries and/or languages to run regression tests against our redirects.

Using httpie, you could get a result like this:

$ http -h Accept-Language: en-US
HTTP/1.1 302 Found
Age: 10564
Location: /en-gb/

Then, I could simply double check on that response status code (302 in this case) and the Location: header.

Problem is everything I’ve tried so far seems to have no effect.

Can i override the Country selector so that my script in the UK, for example would be able to regression test redirections in, say, España.


@kcorey If I’m understanding correctly, you’re asking how you could test the Geo-IP redirection of an ES Country redirect… by making the request from a GB based IP address?

I could be wrong, but I strongly suspect that isn’t possible.
I’ve never seen any override flags/functionality or additional parameters for adjusting/manipulating the behaviour of the Country condition of a redirect.

The only way I know of to test it is to use a VPN to adjust your IP address to the desired target location and then accessing the site.

If the rules were language based you could adjust the Accept-Language as you have in your example request, but obviously the language someone has set in their browser isn’t a great indication of their location on the planet.

Man, that’s disappointing.

If I could, perhaps, set a cookie expressly for testing saying “ignore my IP geolocation, override it to pretend I’m in another country for this test”, then it would be a doddle to create automated tests for all my locales that run on a single machine very quickly.

If we have to bring a VPN into it, we get added complexity and cost to testing.


@kcorey I’d imagine you might be able to put something custom together leveraging Edge Functions though…