Forum Discussion
HG
Cirrus
Oct 17, 2017Irule help - redirect to another VS based on path
Hi all. I would like your help in order to proceed with the following.I would like to redirect traffic based on URI to another VS. For example:
Http://1.1.1.1:8000/test1/ok?wsl
Http://1.1.1.1:8000...
Lee_Sutcliffe
Nacreous
Oct 17, 2017I would probably put all your URIs in a datagroup and use a second 'if' statement rather than a switch statement. This way you can add more URIs without changing the code. Also, if you just want to send traffic to another Virtual server, you can use the 'virtual' command rather than a redirect - unless a redirect is your requirement.
If you set a default pool in in your virtual server, you don't need to specify it in the iRule.
when HTTP_REQUEST {
set lowCaseURI [string tolower [HTTP::uri]]
if {[HTTP::host] equals "1.1.1.1"} {
if {[class match $lowCaseURI starts_with your-uri-dg]} {
virtual name-of-your-vs
}
}
}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
