Forum Discussion
cokeefe28_17139
Jan 16, 2012Nimbostratus
Mobile Device Detection with logic
All, I seem to be spinning my wheels here and I am not sure why. I want to do the following: 1. Detect if a user is coming from a mobile device (for simplicity, we will say o...
nitass
Jan 16, 2012Employee
is www.site.com and m.site.com same virtual server or different?
not sure if i understand correctly or not. this is what i think. the m_rule is assigned to m.site.com virtual server and the www_rule is assigned to www.site.com virtual server.
the www2.site.com host is used if user wants to get content from www.site.com even he is using mobile device.
[root@ve1023:Active] config b rule m_rule list
rule m_rule {
when HTTP_REQUEST {
if {not [class match -- [string tolower [HTTP::header "User-Agent"]] contains mobile_class]}{
HTTP::redirect "http://www.site.com/"
}
}
}
[root@ve1023:Active] config b rule www_rule list
rule www_rule {
when HTTP_REQUEST {
if {[HTTP::host] equals "www2.site.com"} {
return
}
if {[class match -- [string tolower [HTTP::header "User-Agent"]] contains mobile_class]}{
if {[class match -- [string tolower [HTTP::uri]] contains specific_uri_class]} {
set mobile_opt_uri [class match -value [string tolower [HTTP::uri]] contains specific_uri_class]
HTTP::redirect ""
} else {
HTTP::redirect "http://m.site.com/"
}
}
}
}
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