Forum Discussion
Tom_90789
Nimbostratus
Jul 17, 2009Change part of HTTP::host based on User Agent
I am trying to change the HTTP:host for a HTTP::redirect based on the UserAgent identified.
I am able to make it work using a static host, and changing to a different static host, base on the U...
The_Bhattman
Nimbostratus
Jul 20, 2009Understood. You can do another type of command that might work nicely for you called "string map" (Click here)
string map {find1 replace1 find2 replace2} [HTTP::host]
Example
when HTTP_REQUEST {
if { [matchclass [string to lower [HTTP::header "User-Agent"]] contains $::useragent_list ] } {
HTTP::redirect "http://[string map -nocase {"www." "m." } [HTTP::host]][HTTP::uri]"
} else {
HTTP::redirect "http://[string map -nocase {"www." "www2." } [HTTP::host]][HTTP::uri]"
}
}
Hope this helps
CB
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