Forum Discussion
Eddy_161863
Nimbostratus
Oct 06, 2015f5 URL redirection
I am trying to setup a redirect based on the host in the URL. Is there any way to match two host values in the url and if it matches one of the condition, then redirect. I only want to change the hos...
IheartF5_45022
Nacreous
Oct 08, 2015What you have should work for all valid (according to RFC) URL. I'd drop any request with a / in the Host headers
if { [string tolower [HTTP::host]] equals "abc" } {
HTTP::respond 301 Location "http://abc.xyz.com[HTTP::uri]"
return
} elseif { [string tolower [HTTP::host]] ends_with "/" } {
Host headers do not contain /
HTTP::respond 400 content "Bad Request - host header"
return
}
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