Forum Discussion
Harry1
Nimbostratus
Jun 22, 2016redirect http request on another page but backend /VS is same
Hi All,
I simply want to redirect any http request for example "http://10.10.10.10 " to http://10.10.10.10/test/test2/
regards prak
6 Replies
- Harry1
Nimbostratus
I have done this: when HTTP_REQUEST { HTTP::redirect "http://10.10.10.111/testwebsite/" } 10.10.10.111 is the pool member but if I am redirecting to 10.10.10.10 i.e. VS ip, it doesn't work . Hi,
You can try with the following example :
when HTTP_REQUEST { if { [HTTP::path] eq "/" } { HTTP::redirect "http://[HTTP::host]/test/test2/" } }- Hamish
Cirrocumulus
The answer below should be fine. The reasons your approach doesn't work is twofold. 1. When the redirect IP is the VS you will loop. Forever redirecting overtime a request is made. 2. When the redirect IP is the pool member, you're only hitting it once, and the redirected client then never connects to the VS again (Unless an external URL directs it to of course)> H - Vijay_E
Cirrus
Try:
when HTTP_REQUEST { if { ( [HTTP::host] eq "10.10.10.10" ) && ( [HTTP::uri] eq "/" ) } { HTTP::respond 301 Location "http://10.10.10.10/test/test2/" } } - Harry1
Nimbostratus
yes Hamish, but my question is how can i achieve that because i have a test webserver and below is the flow which i want: web server + php script - 172.16.0.51\test VS - 172.16.0.102 when i will only explore https://172.16.0.51 , will not work . for this purpose i will browse like https://172.16.0.51/test now when i introduce LTM and browse like https://VS ip(172.16.0.102) ...it doesn't work..until i redirect it to pool member that is 172.16.0.51/test.... also i don't want anyone see exact pool member ip from where it is originating. - JG
Cumulonimbus
If your situation is what I understand it to be, you can define "Redirect Rewrite" to have the value of "Nodes" in the HTTP profile attached to the virtual server.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects