I am unable to redirect URL on F5 Virtual Appliance please advise

I am unable to redirect URL on F5 Virtual Appliance please advise

I have configured Virtual Server, Pool, Nodes, Monitor, iRule.

ltm virtual SIEBEL_APPLICATION_HTTP_web_http_virtual {

destination 10.50.171.5:http
ip-protocol tcp
mask 255.255.255.255
pool Siebel-Pool-Http
profiles {
    **http** { }
    tcp { }
}
rules {
    **S2T-Redirect**
}
source 0.0.0.0/0
source-address-translation {
    type automap
}
translate-address enabled
translate-port disabled
vs-index 3

}

ltm virtual Testing_Http {

destination 10.50.171.6:http
ip-protocol tcp
mask 255.255.255.255
pool Siebel-Pool-Http
profiles {
    **http** { }
    tcp { }
}
source 0.0.0.0/0
source-address-translation {
    type automap
}
translate-address enabled
translate-port disabled
vs-index 5

}

ltm rule S2T-Redirect {

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] equals "; } {

HTTP::redirect ";

} }

}

Please Advise…

Your if-statement will never match, because it will not include protocol type and hostname. This article will help you construct a proper iRule:

https://devcentral.f5.com/articles/irule-recipe-1-single-url-explicit-redirect-21910

Change below line in your irule

if { [string tolower [HTTP::uri]] equals ";; }

to

if { [string tolower [HTTP::host]] equals “siebel.misali.local” } {

when HTTP_REQUEST {

if { [string tolower [HTTP::host]] equals "http://siebel.misali.local"} { 
HTTP::redirect "http://testing.misali.local" 
}

}

when HTTP_REQUEST {
  if { [string tolower [HTTP::host]] equals "http://siebel.misali.local"} {
    HTTP::respond 301 Location "http://testing.misali.local"
  }
}

0691T000006AqgqQAC.jpg

Hi Prince, No luck. try both type of iRules.

when HTTP_REQUEST {

if { [string tolower [HTTP::host]] equals ";} {

HTTP::redirect ";

}

}

Mate… try the following:

when HTTP_REQUEST {
     if { [string tolower [HTTP::host]] eq "siebel.misali.local" } {
        HTTP::redirect "http://testing.misali.local";
     }
}

Hi,

Both Niels and prince provide you the solution but you still keep http:// in the condition.

Http Host never contains http://

Try this

when HTTP_REQUEST {
  if { [string tolower [HTTP::host]] equals "siebel.misali.local"} {
    HTTP::respond 301 Location "http://testing.misali.local"
  }
}

Dear All,

Stanislas Piron, Prince and Niels van Sluis you all are great. My issue resolved with your help.

“siebel.misali.local” has successfully redirected to ";

Thanks a Million.