Forum Discussion
Ronak_79648
Nimbostratus
Jan 05, 2009HTTP Error 408 / 409 -- iRules from 4.x to 9.x
I have simple iRules in 4.x which allows login page for everyone over https. Login process puts the cookie to client and all other request needs to have cookie to access.
When I try to take sa...
Juerg_Wiesmann
Nimbostratus
Jan 05, 2009when HTTP_REQUEST {
if {[HTTP::cookie exists "User-Name"] }{
if {[HTTP::uri] ends_with "index_out.html" }{
log local0. "URI is [HTTP::uri]"
pool my_web}
if {[HTTP::uri] ends_with "loginForm.jsp" }{
pool my_web}
if {[HTTP::uri] ends_with ".gif"}{
pool my_web}
}
elseif {[HTTP::uri] contains "xyz"}{
HTTP::redirect "https://[HTTP::host]/index_out.html"
log local0. "Redirect1 is https://[HTTP::host]/index_out.html"
}
else {
HTTP::redirect "https://[HTTP::host]/index_out.html"
log local0. "Redirect2 is https://[HTTP::host]/index_out.html"
}
}
or you could use
when HTTP_REQUEST {
if {[HTTP::cookie exists "User-Name"] }{
if {[HTTP::uri] ends_with "index_out.html" or [HTTP::uri] ends_with "loginForm.jsp" or [HTTP::path] ends_with ".gif"} {
log local0. "URI is [HTTP::uri]"
pool my_web}
}
elseif {[HTTP::uri] contains "xyz"}{
HTTP::redirect "https://[HTTP::host]/index_out.html"
log local0. "Redirect1 is https://[HTTP::host]/index_out.html"
}
else {
HTTP::redirect "https://[HTTP::host]/index_out.html"
log local0. "Redirect2 is https://[HTTP::host]/index_out.html"
}
}
or even simpler
when HTTP_REQUEST {
if {[HTTP::cookie exists "User-Name"] }{
if {[HTTP::uri] ends_with "index_out.html" or [HTTP::uri] ends_with "loginForm.jsp" or [HTTP::path] ends_with ".gif"} {
pool my_web}
}
else {
HTTP::redirect "https://[HTTP::host]/index_out.html"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
