Forum Discussion
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
- Kevin_Stewart
Employee
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).
- Fonda_116704
Nimbostratus
Dear Kevin, thanks for the script..it's worked now.. again thanks for support..
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