Forum Discussion
htuytela_37346
Nimbostratus
Dec 12, 2013iRule check for user-agent and set cookie
Hi,
I'm trying to get an iRule to work that checks on User-Agent, being IE6,7,8 and setting a cookie. Basically, I want those browsers to be redirected to another page, and set a cookie. When the...
htuytela_37346
Nimbostratus
Dec 13, 2013thank you for the reply, unfortunately, this did not help. I'm progressing slowly, as the suggestion on using the switch syntax made me try this :
when HTTP_REQUEST {
switch -glob [HTTP::header value "User-Agent"] {
"*MSIE 6*" -
"*MSIE 7*" -
"*MSIE 8*" {
switch -glob [HTTP::cookie exists "test"] ne ""
HTTP::redirect "http://test-lab.foo.com:9610/CG510_APR_RedirectCapriURL/"}
default {
pool site-10.130.14.98_29710
}
}
}
This rule is accepted and there is a difference in testing using IE & Mozilla, so the browser selection seems to work. I enabled cooking persistence on the VS with a cookie named test. However, that did not help. To me, it looks like the iRule is not able to read the cookie.
regards,
Hans
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
