Forum Discussion
Anthony_Vaz_547
Nimbostratus
May 02, 2006I'm really confused
Hi guys
Sorry this should be really simple, but I just can;t get it.
Basically - I am trying to setup a redirection rule.
What I want is, when a request comes in to a virtual server, and the URI is "/", I want the irule to interrogate the request, if there is a cookie called "LtpaToken", then go to pageA, but if the URI is "/" and there is no cookie called "LtpaToken", I want the Irule to redirect to Page B.
And I'm tying myself up in knots.
This is the closest I have got (and I know I'm miles away)
when HTTP_REQUEST {
if {[HTTP::uri] equals "/" } {
if {[HTTP::cookie exists LtpaToken] } {
HTTP::redirect "http://[HTTP::host]/wps/myportal"
} else {
HTTP::redirect "http://[HTTP::host]/wps/portal"
} else {
return
}
}
Should HTTP::cookie be available when I'm using HTTP_REQUEST? Can anyone help point me in the right direction?
Cheers
- This looks good to me except that you have two else statements right next to eachother.
when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { if { [HTTP::cookie exists LtpaToken] } { HTTP::redirect "http://[HTTP::host]/wps/myportal" } else { HTTP::redirect "http://[HTTP::host]/wps/portal" } } }
when HTTP_REQUEST { log local0. "URI is [HTTP::uri]" if { [HTTP::uri] equals "/" } { if { [HTTP::cookie exists LtpaToken] } { log local0. "Cookie LtpaToken exists, redirecting to http://[HTTP::host]/wps/myportal" HTTP::redirect "http://[HTTP::host]/wps/myportal" } else { log local0. "Cookie LtpaToken does not exist, redirecting to http://[HTTP::host]/wps/portal" HTTP::redirect "http://[HTTP::host]/wps/portal" } } }
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