Forum Discussion

nrelihan_68143's avatar
Icon for Nimbostratus rankNimbostratus
Jul 08, 2011

Redirecting to regional website depending on user DNS.

Hey all, I'm quite new to F5 irules first of all.



Perhaps I'll tell you what I have working first and then explain to you what additional things I'd like to do.



What I have working



When somebody goes to it looks at their dns location and redirects it to their a regional website, in my example here, its Ireland and UK. So when somebody goes to this website when in Ireland it will redirect them to and to when in the UK.


I have two pools setup, one for ireland and one for the UK.



Global traffic irule





if {[whereis [IP::client_addr]] contains "IE"} {


pool pool-Ireland


} elseif {[whereis [IP::client_addr]] contains "GB"} {


pool pool-UK


} else {


pool pool-default



pool-UK Local traffic irule





if {[HTTP::uri] equals "/" } {


HTTP::respond 302 Location ""







pool-Ireland Local traffic irule





if {[HTTP::uri] equals "/"} {


HTTP::respond 302 Location ""








What Im looking to do




Im looking to enhance this like so:


For example when somebody is located in the UK types the irule would redirect them to the UK website but including the static page they requested,


When somebody is located in irealnd they type the irule would redirect them to



What I'm afriad though is that if somebody based in Ireland but for some reason had a UK ip address and visa versa, typed in, it would still re-direct them to the website. So in other words they would never be able to get to the .com/ireland website.


So would it be possible to include a rule that would not allow this to occur.


Maybe the rule might say, if they type in, do not put it though an irule?



Any help is appreciated, my brain is melting trying to get working code for this!



Thanks alot!





19 Replies