Forum Discussion
help with reference to an iRule creation.
Hi, I need to create an iRule which essentially redirects a https site to another https site but also if there is some URI in the original site this iRule should not take any action.
e.g. redirect https://abc.test.com to https://xyz.test.com. If the request is for https://abc.test.com/support then do not redirect.
Any help? In my case the URI could just be anything, does a "*" work in that case?
This is what I have with me:
when HTTP_REQUEST { if { [HTTP::uri] contains "/*"} {pool abc.test.com} else {HTTP::redirect "https://xyz.test.com"} }
Thanks, Nik.
3 Replies
- Cory_50405
Noctilucent
This will redirect only in the case that the host is abc.test.com and the URI has no value specified (default is /):
when HTTP_REQUEST { if { [[HTTP::host] eq "abc.test.com"] and [[HTTP::uri] eq "/"] } { HTTP::redirect "https://xyz.test.com" } }
- Steve_M__153836
Nimbostratus
Would it be a good idea to do when HTTP_REQUEST { if { [[HTTP::host] eq "abc.test.com"] and [[HTTP::uri] ne "/support"] } { HTTP::redirect "https://xyz.test.com" } } in case someone puts some additional path after the "/" that isn't "support"?
- Arie
Altostratus
If the resources on the original domain are in flux (e.g. if files are added/removed regularly) you can create a dynamic solution that triggers the redirect only if the original request resulted in an HTTP response code 404. I can elaborate if necessary.
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