HG
Oct 17, 2017Cirrus
Irule 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/test5/okok?rore
Http://1.1.1.1:8000/intern/testok?ok
to
Http://2.2.2.2:8000/test1/ok?wsl
Http://2.2.2.2:8000/test5/okok?rore
Http://2.2.2.2:8000/intern/testok?ok
I would like this to work only for those specific paths.I have in mind something like the irule below. Could you please advice ?
when HTTP_REQUEST
{
set lowCaseURI [string tolower [HTTP::uri]]
if {[HTTP::host] equals "1.1.1.1"}
{
switch -glob $lowCaseURI
{
"/test1/ok?wsl"
"/test5/okok?rore"
"/intern/testok?ok"
{ HTTP::redirect "http://2.2.2.2"}
default
{pool 1.1.1.1}
}
}