Forum Discussion
rdessert_76127
Jul 19, 2012Nimbostratus
Help with adding mobile redirect to existing irule
Hi all,
I have been asked to redirect a handful of mobile device types (user agents) to our mobile homepage and am having some trouble getting the irule configured properly.
My cur...
nitass
Jul 20, 2012Employee
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if {[HTTP::host] equals "site.com"} {
if {[class match -- [string tolower [HTTP::header value "User-Agent"]] equals mobile_class]} {
HTTP::respond 301 Location "http://m.site.com[HTTP::uri]"
} else {
HTTP::respond 301 Location "http://www.site.com[HTTP::uri]"
}
} else {
switch -glob [string tolower [HTTP::uri]] {
"/" -
"/*" -
"/\\?*" -
"/foo/*" -
"/news/*" -
"/sites/*" -
"/node/*" { pool op_pool }
default { pool def_pool }
}
}
}
}
[root@ve10:Active] config curl -I http://172.28.19.79/something -H "Host: site.com"
HTTP/1.0 301 Moved Permanently
Location: http://www.site.com/something
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config curl -I http://172.28.19.79/something -H "Host: site.com" -H "User-Agent: iphone"
HTTP/1.0 301 Moved Permanently
Location: http://m.site.com/something
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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