redirect 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

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/"
    }
}

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

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/"
}
}

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.

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.