Forum Discussion
Redirect based on User-Agent
Hello,
We have an application that was recently upgraded (without our knowledge) and half of our users still use IE8. The new version of the application is not compatible with IE8 but the app owners have created a path for IE8 users. I'd like to create an iRule that will direct IE8 users to the compatible version and everyone else to the new version. Here is what I have so far but it is not redirecting me to the IE8 version of the site. Any issues with my iRule? Thanks in advance.
when HTTP_REQUEST {
if { [string tolower [HTTP::header User-Agent]] contains "*msie8*" } {
HTTP::redirect "http://onbase.com/OnBaseWeb12/"
} else {
HTTP::redirect "http://onbase.com/OnBaseWeb/"
}
}
1 Reply
- cjunior
Nacreous
Hi,
Try changing the "*msie8*" to "msie 8" (with space, no wildcard). IE user-agent reference: http://www.useragentstring.com/pages/Internet%20Explorer/Example:
when HTTP_REQUEST { if { [string tolower [HTTP::header User-Agent]] contains "msie 8" } { if { not ([string tolower [HTTP::path]] starts_with "/onbaseweb12/") } { HTTP::redirect "http://onbase.com/OnBaseWeb12/" } } else { if { not ([string tolower [HTTP::path]] starts_with "/onbaseweb/") } { HTTP::redirect "http://onbase.com/OnBaseWeb/" } } }My IE9 is doing request with header "MSIE 7.0", so, maybe this condition will not work in some cases.
What about add a X-UA-Compatible header and change the IE rendering type?when HTTP_RESPONSE { HTTP::header insert "X-UA-Compatible" "IE=8" }I hope it helps.
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
