Forum Discussion
Piyush_72418
Nimbostratus
Feb 24, 2009check
If I have a Geo IP based domain resolution @ DNS.
like based on Geo location abc.com will be resolved to either a.b.c.d (if US) and e.f.g.h (if from India)
Can I write a iRule on BigIP F5 LTM to have following functionality :
whenver request resolved from DNS to a.b.c.d redirect to http://abc.com/home_us.html
and when resolved to e.f.g.h redirect to http://abc.com/home_in.html
Thanks
Piyush
- The_Bhattman
Nimbostratus
Hi Piyush,when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr] equals a.b.c.d/8] } { HTTP::redirect "http://abc.com/home_us.html" } elseif {[IP::addr [IP::client_addr] equals e.f.g.h/8] } { HTTP::redirect "http://abc.com/home_in.html" } }
class usa{ a.b.c.d 255.255.0.0 m.n.o.p 255.0.0.0 } class india { e.f.g.h 255.255.0.0 i.j.k.l 255.0.0.0 } when CLIENT_ACCEPTED { if { [matchclass [IP::client_addr] equals $::usa] } { HTTP::redirect "http://abc.com/home_us.html" } elseif {[matchclass [IP::client_addr] equals $::india] } { HTTP::redirect "http://abc.com/home_in.html" } }
- Piyush_72418
Nimbostratus
Hi CB, - Piyush_72418
Nimbostratus
Also IP::client_addr is the IP address of the Client Connected (User) - hoolio
Cirrostratus
You can change the event from CLIENT_ACCEPTED to HTTP_REQUEST. In this case, CLIENT_ACCEPTED is triggered when the client establishes a TCP connection with the VIP. The HTTP headers have not been parsed at this point. HTTP_REQUEST is when the HTTP headers have been parsed. You can't send an HTTP redirect in CLIENT_ACCEPTED, but can in HTTP_REQUEST.class my_address_datagroup { network 10.10.0.0/16 host 192.168.0.11 }
- Piyush_72418
Nimbostratus
Just FYI .. I know the values of a.b.c.d & e.f.g.h - Piyush_72418
Nimbostratus
Posted By hoolio on 02/24/2009 11:43 PM
class my_address_datagroup { network 10.10.0.0/16 host 192.168.0.11 }
- hoolio
Cirrostratus
- hoolio
Cirrostratus
Hi Piyush,when HTTP_REQUEST { Check if requested path is / if {[HTTP::path] eq "/"}{ Redirect client to initial page HTTP::redirect "http://abc.com/home_india.html" } else { Send to VIP2 (where VIP2 is the name of the second VIP) virtual VIP2 } }
when HTTP_REQUEST { Check if requested path is / if {[HTTP::path] eq "/"}{ Redirect client to initial page HTTP::redirect "http://abc.com/home_us.html" } Default action is to use the default pool on the VIP }
- hoolio
Cirrostratus
Note that in order to use the virtual command (Click here), you must be running 9.4.0 or higher. - Piyush_72418
Nimbostratus
Thanks Aaron !!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects