Forum Discussion
pmaubo2_55685
Nimbostratus
Oct 31, 2012HTTP::header User-Agent question
I have an irule for we are setting up for featured mobile phones and smart phones.
1 data class list many different codes, for example nokia, the non-smartphones.
The other data class just ...
nitass
Employee
Nov 01, 2012as nathan mentioned, i just removed "https://" from Steve's irule. additionally, since you do string tolower twice, you had better save it to variable and re-use it.
when HTTP_REQUEST {
set wap "https://wapsite.com/uri"
set normal "https://normal.com/uri"
set smart "https://smartphonesite.com/uri"
if { [HTTP::host] equals "mysite.com" } {
set user_agent [string tolower [HTTP::header User-Agent]]
if { [class match -- $user_agent contains user_agent_tokens_class] } {
log local0. "wap phone"
HTTP::redirect $wap
} elseif { [class match -- $user_agent contains mobile_device_providers] } {
log local0. "smart phone"
HTTP::redirect $smart
} else {
log local0. "Normal web site"
HTTP::redirect $normal
}
}
}
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