Forum Discussion
Kevin_Stewart
Nov 14, 2013Employee
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 "/"
}
}