Forum Discussion
OCC_68606
Nimbostratus
Jun 14, 2011iRule Redirect Mobile Site
I have this iRule to identify mobile browser, for example apple devices:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "www.mainsite.com" } { ...
nitass
Employee
Mar 07, 2013if i want to use mre mobile types will below iRule worksno, syntax is not correct. you should use "switch" or "class match" with data group.
this is an example of class match with data group.
[root@ve10:Active] config b class mobile_class list
class mobile_class {
{
"android"
"iphone"
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { [HTTP::host] equals "home.example.co.in" } {
if { [URI::query "?&[HTTP::query]" main] equals "true" } {
return
}
if { [class match -- [string tolower [HTTP::header "User-Agent"]] contains mobile_class] } {
HTTP::redirect "https://lite.example.co.in"
}
} elseif { [URI::query "?&[HTTP::query]" main] equals "true" } {
HTTP::redirect "https://home.example.co.in?main=true"
}
}
}
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