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...
oguzy
Cirrostratus
Jan 16, 2018Hi Yuri,
You can try the below code.
Code
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 {
HTTP::redirect "https://www.bbb.com[HTTP::uri]"
}
}
}
}
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