Skip to main content
edited body
Source Link
Peter Procházka
  • 9.5k
  • 2
  • 30
  • 71

We are usually faking local IP address in this case.

We use querystring such as "?ipaddress={Fake_Ip_goes_here}" to inject faked ip address.

In your code, in place where you determine IP address, just add another condition if this query string is present, use value provided instead.

There are sites like this one https://www.nirsoft.net/countryip/ which will help you get proper IP for particular country to test whether redirection is working as expected.

Of course on production environment this is not desired so we usually introduce thissome kind of Settingsetting "EnableSettingIpAddressFromQueryString" which is on production set to False and we add another condition to upper one whether this setting is true so we only enable setting IP address from query string on non-production servers.

We are usually faking local IP address in this case.

We use querystring such as "?ipaddress={Fake_Ip_goes_here}" to inject faked ip address.

In your code, in place where you determine IP address, just add another condition if this query string is present, use value provided instead.

There are sites like this one https://www.nirsoft.net/countryip/ which will help you get proper IP for particular country to test whether redirection is working as expected.

Of course on production environment this is not desired so we usually introduce this kind of Setting "EnableSettingIpAddressFromQueryString" which is on production set to False and we add another condition to upper one whether this setting is true so we only enable setting IP address from query string on non-production servers.

We are usually faking local IP address in this case.

We use querystring such as "?ipaddress={Fake_Ip_goes_here}" to inject faked ip address.

In your code, in place where you determine IP address, just add another condition if this query string is present, use value provided instead.

There are sites like this one https://www.nirsoft.net/countryip/ which will help you get proper IP for particular country to test whether redirection is working as expected.

Of course on production environment this is not desired so we usually introduce some kind of setting "EnableSettingIpAddressFromQueryString" which is on production set to False and we add another condition to upper one whether this setting is true so we only enable setting IP address from query string on non-production servers.

Source Link
Peter Procházka
  • 9.5k
  • 2
  • 30
  • 71

We are usually faking local IP address in this case.

We use querystring such as "?ipaddress={Fake_Ip_goes_here}" to inject faked ip address.

In your code, in place where you determine IP address, just add another condition if this query string is present, use value provided instead.

There are sites like this one https://www.nirsoft.net/countryip/ which will help you get proper IP for particular country to test whether redirection is working as expected.

Of course on production environment this is not desired so we usually introduce this kind of Setting "EnableSettingIpAddressFromQueryString" which is on production set to False and we add another condition to upper one whether this setting is true so we only enable setting IP address from query string on non-production servers.