Forum Discussion
Tyranon_113005
Nimbostratus
Jan 15, 2018HTTP redirect by HOST and URL
Hello,
I'm trying redirect HTTP request depends on HTTP host and url.
Example,
https://www.aaa.com/123 -> https://www.bbb.com/specified1
https://www.aaa.com/456 -> https://www.bbb.com/s...
Stanislas_Piro2
Cumulonimbus
Jan 15, 2018Your code will loop!
If you want the request to be forwarded to the server, don't use redirect command!
when HTTP_REQUEST {
if { [HTTP::host]] equals "www.aaa.com"}{
switch [HTTP::uri] {
"/123" { HTTP::redirect "https://www.bbb.com/specified1" }
"/456" { HTTP::redirect "https://www.bbb.com/specified2" }
}
default {
forward the request... no action
}
}
}
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