Forum Discussion
HTTP URI redirection to specific URL
Hi - i have a following scenario;
HTTP VS - http://www.abc.com (redirecting to HTTPS) HTTPS VS - https://www.abc.com
Now customer wants to implement the following logic;
If anyone go to http://www.abc.com/CustomAB/* redirects it to http://xyz.test.com/services.txt
I have tried this irule on HTTP VS but it doesn't work ...
when HTTP_REQUEST { if { [HTTP::host] equals "; and [HTTP::path] equals "/CustomAB/*" } { HTTP::redirect "; } else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
2 Replies
- Vijay_E
Cirrus
Try this (untested):
when HTTP_REQUEST { if { ([HTTP::host] eq "www.abc.com") and ([HTTP::uri] starts_with "/CustomAB/") } { HTTP::redirect "http://xyz.test.com/services.txt" } else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } } - Angelo_V
Cirrus
Hi,
[HTTP::host] contains only the host name without protocol (http, https).
when HTTP_REQUEST { if { [HTTP::host] equals "www.abc.com" and [HTTP::uri] starts_with "/CustomAB/" } { HTTP::redirect "http://xyz.test.com/services.txt" } else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
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