Forum Discussion
Redirect initial request to a different URL
Let's assume that the request for "/context/first.jsp" is followed by subsequent calls to the same URL, and that all happen within the same TCP session. If that is the case, then Steve's iRule above should fill the requirement. The condition is triggered ONLY if the request is for "/context/first.jsp", AND ONLY if this is the first request in the TCP session.
Otherwise, given the stateless nature of HTTP, you'd probably have to resort to a state mechanism like cookies to prevent further triggering of the condition. Example:
when HTTP_REQUEST {
if { not ( [HTTP::cookie exists STATECOOKIE] ) } {
First time through
set setcookie 1
if { [string tolower [HTTP::uri]] starts_with "/context/first.jsp" } {
HTTP::uri /context/login.jsp
pool pool_80
} else {
your other logic
}
}
}
when HTTP_RESPONSE {
will insert the cookie on first response
if { [info exists setcookie] } {
unset setcookie
HTTP::cookie insert name "STATECOOKIE" value "1" path "/"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
