# Geoip redirect by country codes but exclude a client with dynamic ip

**URL:** <https://www.ruby-forum.com/t/geoip-redirect-by-country-codes-but-exclude-a-client-with-dynamic-ip/200286>\
**Category:** NGINX\
**Created:** [December 8, 2010, 3:04pm UTC](https://www.ruby-forum.com/t/geoip-redirect-by-country-codes-but-exclude-a-client-with-dynamic-ip/200286 "2010-12-08T15:04:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 8, 2010, 3:04pm UTC](https://www.ruby-forum.com/t/geoip-redirect-by-country-codes-but-exclude-a-client-with-dynamic-ip/200286/1 "2010-12-08T15:04:00Z")

</div>

Hello,

The site has geoip redirection to subdomains using country codes, before  
we only needed to exclude a directory from redirection but now my client  
is asking me to exclude himself from it, how can I do this ?

Please note that his ip is dynamic, thanks for any help.

Posted at Nginx Forum:

> **[Geoip redirect by country codes but exclude a client with dynamic ip](https://forum.nginx.org/read.php?2,156771,156771#msg-156771)**
>
> Hello, The site has geoip redirection to subdomains using country codes, before we only needed to exclude a directory from redirection but now my client is asking me to exclude himself from it, how can I do this ? Please note that his ip is dynamic,...

---

<div class="post-metadata">

**Author:** ![st1905](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/35a633/32.png) [@st1905](https://www.ruby-forum.com/u/st1905)\
**Post date:** [December 8, 2010, 4:28pm UTC](https://www.ruby-forum.com/t/geoip-redirect-by-country-codes-but-exclude-a-client-with-dynamic-ip/200286/2 "2010-12-08T16:28:07Z")

</div>

Just an update, I used a custom user-agent to disable redirect for the  
client, there is a plugin for firefox that allows to use custom  
user-agents so he selects it and redirection stops, a simple if  
statement in nginx config is applied for this purpose.

Posted at Nginx Forum:

> **[Re: Geoip redirect by country codes but exclude a client with dynamic ip](https://forum.nginx.org/read.php?2,156771,156803#msg-156803)**
>
> Hello, The site has geoip redirection to subdomains using country codes, before we only needed to exclude a directory from redirection but now my client is asking me to exclude himself from it, how can I do this ? Please note that his ip is dynamic,...

---

<div class="post-metadata">

**Author:** ![st1905](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/35a633/32.png) [@st1905](https://www.ruby-forum.com/u/st1905)\
**Post date:** [December 8, 2010, 8:48pm UTC](https://www.ruby-forum.com/t/geoip-redirect-by-country-codes-but-exclude-a-client-with-dynamic-ip/200286/3 "2010-12-08T20:48:31Z")

</div>

Hi,

If your only data is a dynamic IP, then i guess you’d have to rely on  
the user agent. You might be able to replace that if-statement, what  
are you using?

Cheers,  
Nuno

–  
Mars 2 Stay!

> **[Golden Hammer](https://xkcd.com/801/)**
>
> Took me five tries to find the right one, but I managed to salvage our night out--if not the boat--in the end.

/etc

---

<div class="post-metadata">

**Author:** ![st1905](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/35a633/32.png) [@st1905](https://www.ruby-forum.com/u/st1905)\
**Post date:** [December 9, 2010, 9:17pm UTC](https://www.ruby-forum.com/t/geoip-redirect-by-country-codes-but-exclude-a-client-with-dynamic-ip/200286/4 "2010-12-09T21:17:29Z")

</div>

Hi,

Its

if ( $http\_user\_agent = “BLABLA” ){  
break;  
}

Thanks for the reply.

Posted at Nginx Forum:

> **[Re: Geoip redirect by country codes but exclude a client with dynamic ip](https://forum.nginx.org/read.php?2,156771,157267#msg-157267)**
>
> Hello, The site has geoip redirection to subdomains using country codes, before we only needed to exclude a directory from redirection but now my client is asking me to exclude himself from it, how can I do this ? Please note that his ip is dynamic,...
