Forum Discussion
shlomi_133455
Nimbostratus
Sep 11, 2013redirect Server side with no header User-Agent
Hello,
I would like to create a rule that redirect only requests with no "User-Agent" I have a rule now that redirect Pc browsers and a switch in the rule that redirect mobile agents.
I need another ...
Kevin_Stewart
Employee
Sep 11, 2013You might try "" as one of the switch conditions, but I haven't tested that. This should work though:
when HTTP_REQUEST {
if ( not ( [HTTP::header exists User-Agent] ) } {
HTTP::redirect "http://mywebsite/[HTTP::uri]"
} else {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*blackberry*" -
"*ipad*" -
"*iphone*" -
"*ipod*" {
return
}
default {
HTTP::redirect "http://mywebsite/[HTTP::uri]"
}
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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