Forum Discussion
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
- Prince_165600Nimbostratus
Change below line in your irule
if { [string tolower [HTTP::uri]] equals ";; }
to
if { [string tolower [HTTP::host]] equals "siebel.misali.local" } {
- Misbah_Ul_Haq_3Nimbostratus
Hi Prince, No luck. try both type of iRules.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals ";} {
HTTP::redirect ";
}
}
- Misbah_Ul_Haq_3Nimbostratus
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" } }
- Stanislas_Piro2Cumulonimbus
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" } }
- Misbah_Ul_Haq_3Nimbostratus
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.
- WithF5_193496Nimbostratus
Mate... try the following:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "siebel.misali.local" } { HTTP::redirect "http://testing.misali.local"; } }
Recent Discussions
Related Content
* 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