Forum Discussion
Redirect based on uri
Im having trouble with requests that i need to redirect based on uri. My irule is
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/test/" - "/test1/"
{ HTTP::redirect "http://redirected.server.com[HTTP::uri]" } default {
pool POOL_MainPool_Server-80 } }
}
I want to have any request that is for www.request.com/test to go to second server.
It works fine for any request that includes the / eg: www.request.com/test/ but not without the /
If i remove the / from my irule eg "/test" then any request such as www.request.com/testing also redirects but I dont want it to.
Also I dont want it picking up on the secondary level eg /Firstlevel/test/ I want the exact match of /test/ but include if the request is just default page /test
Does anyone now how I would go about this?
Thanks in advance Brett
2 Replies
Hi Brett!
If you use /test as an option "/testing" or /Firstlevel/test/ would not trigger it. Only starts_with and contains would.
/Patrik
Ps. You might want to remove the "-glob" since it forces the LTM to work with single core while processing traffic on VIP's that has this iRule assosiated with them (unless you need wild card matching, which you don't in your example. Ds.
- Brett__01_13258
Nimbostratus
Thanks Patrik. this is a duplicate call. I have moved it over to this one below which you have already answered. I have also updated so any help would be appreciated
https://devcentral.f5.com/questions/irule-redirect-on-uri-including-default-location
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