Forum Discussion
iRule to break looping
Hi
I have dynamic urls and currently my iRule is 'looping' on itself so I need to refine. I have two basic url that need to be handled by one iRule. uri 1: hostname/ uri 2: hostname/webprocess.srv
what I am looking for is if I match either of these how do I redirect to uri 3: hostname2/login?
I was using contains or equals but getting a loop back on itself and never get to uri 3. any help would be appricated.
- crodriguezRet. Employee
Maybe something like this?
when HTTP_REQUEST { if { ([HTTP::host] equals "hostname" && [HTTP::uri] equals "/") || ([HTTP::host] equals "hostname" && [HTTP::uri] starts_with "/webprocess.srv") } { HTTP::redirect "http://hostname2/login" } }
Unless hostname2 has some sort of redirect back to hostname, you should not encounter a loop.
- cstalker_366429
Nimbostratus
actually we have tried that, I need to expand on my initial statement, uri 2 includes a query string that is dynamic so it could be uri2: hostname/webprocess.srv?a=1,b=1 or ?a=2,b=2 that was why we were using contains but it loops the first equals on url1 works fine but not the second.
- crodriguezRet. Employee
I amended my answer to change the "equals" on the webprocess.srv check to "starts_with"
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