Forum Discussion
iRule to load balance by browser type
I have an internal company request to load balance incoming requests by browser type. Is there an iRule already widely used in order to do this? Thanks in advance.
Jeffrey
7 Replies
- Jeffrey_Morrow
Nimbostratus
Thanks Vernon. Appreciate the assist.
Jeffrey
- Jeffrey_Morrow
Nimbostratus
I received some updated needs for this iRule. They intend to use the same VIP larrymoecurly.mysite.com, the same pool, the same nodes, but direct the client to a separate login based on the browser. So, if using Firefox and Safari, they want the client to go to larrymoecurly.mysite.com/wfc/login. If using IE, then translate the URL larrymoecurly.mysite.com/wfc/loginIEHere. One VIP/Pool/Node(s).
Has there been an iRule created that will work based on borwser, AND send it off to a specific URL ?
Thanks.
- VernonWells
Employee
Absolutely. The easiest way is to send an HTTP Redirect to the client:
If you prefer to transparent rewrite the URI:
- Jeffrey_Morrow
Nimbostratus
Do I insert two iRules for the VIP, or combine the two you've answered with? Thanks for your help.
- VernonWells
Employee
You can simply combine the two. This is an incomplete example, but should get you heading where you need:
when HTTP_REQUEST { if { [HTTP::uri] eq "/"} { switch -glob [HTTP::header value "User-Agent"] { "*MSIE 6*" - "*MSIE 7*" - "*MSIE 8*" { HTTP::redirect "http://larrymoecurly.mysite.com/wfc/loginIEHere" } default { HTTP::redirect "http://larrymoecurly.mysite.com/wfc/login" } } } }It would be possibly fruitful to read this article:
If it's possible, it may be more robust to have the client use Javascript to determine the version then insert that information in the request, in a header, or in a Cookie. This may be more reliable (and flexible) than using the User-Agent string.
Finally, if you are using at least 11.4.0, you can likely achieve what you want by using Local Traffic Policies:
- Jeffrey_Morrow
Nimbostratus
Vernon,
Thanks so much for the assist. Learning all this admin stuff on the fly. Hopefully get to F5 training soon. Much appreciated. Jeffrey
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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