For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Fonda_116704's avatar
Fonda_116704
Icon for Nimbostratus rankNimbostratus
May 13, 2014

Redirect virtual server to complete url

Dear all..

 

I have one virtual server with 3 physical servers. Where the physical server using port 7777 (OAS). This one virtual server using port 80 to directing to port 7777. I've done with by typing www.abc.com then successfully opened www.abc.com ( port 7777 page )

 

Now I want to make iRule, where by typing www.abc.com then will be redirected to " www.abc.com:7777/blah/blah/blah ". How do I make the right script for this?

 

This is a script i found in internet but is not worked

 

when HTTP_REQUEST { HTTP::redirect http://[getfield [HTTP::host] ":" 1]/bla/bla/bla }

 

With this script when I typing www.abc.com then goes to www.abc.com/bla/bla/bla exclude port 7777.

 

Thank you very much and sorry for my bad English. Hendri.

 

2 Replies

  • You wouldn't want to redirect to www.abc.com:7777, because that would cause the browser to try to open the connection on port 7777, and your VIP is only listening on port 80. At most you'd want to add the port to the Host header on its way through the proxy, but that's rarely necessary. The pool itself should be defined with the services listening on port 7777.

    when HTTP_REQUEST {
        if { [HTTP::uri] equals "/" } {
            HTTP::redirect "http://[HTTP::host]/blah/blah/blah"
        } else {
            HTTP::header replace Host "www.abc.com:7777"
        }
    }
    

    If the URI is empty (/), then redirect to /blah/blah/blah. Otherwise replace the incoming Host header (as required).

  • Dear Kevin, thanks for the script..it's worked now.. again thanks for support..