Forum Discussion
Can I have a iRule do 2 actions when it matches a uri?
Can I have a iRule do 2 actions when it matches a uri? Everything I try seems to end up in a loop.
This is the logic I was looking for:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/app1" } {
HTTP::redirect "http://www.company.com/app1/app/login.aspx") and (pool app1) really all I want to add on is /app/login.aspx
} else {
pool everythingelse
}}
Thanks in advance!
2 Replies
- Kevin_Stewart
Employee
Well, there's two things going on here.
-
First, you cannot send to a pool and redirect at the same time. It's conflicting logic.
-
You're causing a loop because your redirect always matches the first condition. If URI starts with /app1, redirect to /app1/app/login.aspx...and repeat indefinitely. Your best bet may be to be more specific with your condition. Something like this:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "/app1" } { HTTP::redirect "http://[HTTP::host]/app1/app/login.aspx" } elseif { [HTTP::uri] equals "/app1/app/login.aspx" } { pool app1 } else { pool everythingelse } }
-
- Kevin_Stewart
Employee
Or perhaps this:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "/app1" } { HTTP::redirect "http://[HTTP::host]/app1/app/login.aspx" } elseif { [HTTP::uri] starts_with "/app1/" } { pool app1 } else { pool everythingelse } }
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