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 same logic to 9.x the login page gives 408/409 error.
I am trying to
when HTTP_REQUEST {
set uri [HTTP::uri]
if {[HTTP::cookie exists "User-Name"] || $uri contains "index_out.html" || $uri contains "loginForm.jsp" || $uri ends_with "gif" } {
pool my_web
}
elseif {$uri contains "xyz"}{
HTTP::redirect "https://[HTTP::host]/index_out.html"
}
else {
HTTP::redirect "https://[HTTP::host]/index_out.html"
}
}
Any help?
Thanks
ronak
- Juerg_Wiesmann
Nimbostratus
Hi ronakwhen HTTP_REQUEST { if {[HTTP::cookie exists "User-Name"] }{ log local0. "Cookie-Is-there" if {[HTTP::uri] ends_with "index_out.html" }{ 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" } }
- Ronak_79648
Nimbostratus
thanks for prompt reply. the header looks like - Ronak_79648
Nimbostratus
Also, here is how it works in 4.x - Juerg_Wiesmann
Nimbostratus
when 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" } }
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" } }
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" } }
- Ronak_79648
Nimbostratus
I think I am not explaining it right. The way code is suggested it will go in infinite re-direct loop as when client first request login page cookie is not there. - Juerg_Wiesmann
Nimbostratus
In that case give it another try:when HTTP_REQUEST { if {[HTTP::cookie exists "User-Name"] or [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 pool_hackit} else { HTTP::redirect "https://[HTTP::host]/index_out.html"} }
- Ronak_79648
Nimbostratus
I tried this before i tried elseif. when i use if else stmt i get this error - Juerg_Wiesmann
Nimbostratus
This normally happens when a } missmatch exists.when HTTP_REQUEST { if {[HTTP::cookie exists "User-Name"] or [HTTP::uri] ends_with "index_out.html" or [HTTP::uri] ends_with "loginForm.jsp" or [HTTP::path] ends_with ".gif"} { pool pool_hackit} else {HTTP::redirect "https://[HTTP::host]/index_out.html"} }
- Ronak_79648
Nimbostratus
From where i can get iruleEditor? I added this -- the one you suggested earlier as if {[HTTP::cookie exists "User-Name"] }{ - Colin_Walker_12Historic F5 AccountYou can get the iRule editor in the Labs section of DevCentral, here - Click here
when HTTP_REQUEST { if { ([HTTP::uri] ends_with "index_out.html") or ([HTTP::uri] ends_with "loginForm.jsp") or ([HTTP::path] ends_with ".gif") or ([HTTP::cookie exists "User-Name"]) } { log local0. "URI is [HTTP::uri]" pool pool_pluse_web } else { HTTP::redirect "https://[HTTP::host]/index_out.html" } }
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