Forum Discussion
dean_02_164511
Nimbostratus
Mar 09, 2016Redirect match country and string not in url
I'm using a datagroup like below and the Irule like below. I'm trying to add a statement where if it matches the country australia and doesn't have pid=search in the url, redirect to x else redirect ...
Faruk_AYDIN
Altostratus
Mar 09, 2016to do list we add secodary URL for each country. firstly, modify iRule like that:
when HTTP_REQUEST { set countryCode [whereis [IP::client_addr]] if {[HTTP::uri] contains "pid=search"} { append countryCode "2" } set redir [class match -value -- $countryCode contains country-redirect] if { $redir ne "" } { HTTP::redirect $redir } else { HTTP::redirect "http://default.example.com/" } }
add a secodary url for each country in the data group:
ltm data-group internal country-redirect { records { AU { data http://www.example1.com/ } AU2 { data http://www2.example1.com/ } CR { data http://www.example2.com/ } CR2 { data http://www2.example2.com/ } MX { data http://www.example2.com/ } MX2 { data http://www2.example2.com/ } UK { data http://www.example1.com/ } UK2 { data http://www2.example1.com/ } US { data http://www.example1.com/ } US2 { data http://www2.example1.com/ } } type string }
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