Forum Discussion
HD_117145
Nimbostratus
Sep 23, 2013Mobile iRule help to stay on MainSite
Hello all,
I have an iRule which redirects me to mobile website. This mobile website sends in Request Parameter STOP_MOBI=Yes (Stop Mobile Website and render main website) to stay on the Main We...
Kevin_Stewart
Employee
Sep 23, 2013Try this:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "www.mysite.com" } {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*androind*mobile*" -
"*iphone*" -
"*ipod*" {
if { [HTTP::cookie exists stop_mobi] } {
cookie exists - do nothing (stay here)
return
} else {
switch [URI::query [HTTP::uri] stop_mobi] {
"yes" {
URI exists and equals "yes"
set stop_mobi_cookie 1
}
default {
URI doesn't exist - redirect
HTTP::redirect "https://m.mysite.com"
TCP::close
event disable
}
}
}
}
}
}
}
when HTTP_RESPONSE {
if { [info exists stop_mobi_cookie] } {
unset stop_mobi_cookie
HTTP::cookie insert name stop_mobi value 1
}
}
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