Forum Discussion
F5 URL redirection
Hi,
I am facing problem with the redirection. I have four server which are accessble on for the users on the below URL.
http://172.16.15.32:7778/forms/frmservlet?config=tr http://172.16.15.31:7778/forms/frmservlet?config=tr
I want to give the user only one virtual IP so that they dont need to type full URl.
http://abc
I have done the below mention settings but it is not working.
ltm pool PL_AD_POL { members { } AD_6:interwise { address 172.16.15.35 session monitor-enabled state up } AD_7:interwise { address 172.16.15.36 session user-disabled state up } } monitor AD_POL_7778 partition PRODUCTION
ltm rule AD_POL { partition PRODUCTION when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "http://192.168.210.214:7778/forms/frmservlet?config=tr"
ltm virtual VS_AD_POL { destination 192.168.210.214:http ip-protocol tcp mask 255.255.255.255 partition PRODUCTION persist { PROD_STICKY { default yes } } pool PL_AD_POL profiles { /Common/tcp { } PROD_HTTP_Profile { } } rules { AD_POL } snat automap vlans-disabled
My traffic is not getting redirecting. When I am changing the port on VIP to port 7778 and removing the irule I am able to open the webpage by typing full URL. But i want to have the redirection and user wilil only open the http://abc
Please assist what I am missing.
12 Replies
- Philippe_CLOUP
Employee
Hi Wasim, i think i am missing from your configuration, the virtual where you send the traffic after being redirected: 192.168.210.214:7778 I see you redirect command in the iRule, but i don't see the virtual listening on port 7778 for this IP, and the virtual you listed is not wildcard for the ports (HTTP only). If you send a rediret from the iRule, the IP address is the one you put in the redirect, notthe one corresponding to the pool members.
- Wasim_Hassan_13
Nimbostratus
Thanks for the reply,
Yes you are right, My VIP is listening only on port 80. But my servers are listening only ony port 7778 not the port 80.
So you mean to say, I need to create a new VIP for port 7778 and what else i need to modify in the irule in order to make it work.
- Wasim_Hassan_13
Nimbostratus
Hi, I have created one more VIP on port 7778 and recall this new VIP under the irule and i can see the web page now. But my webpage is showing the IP address which i dont want to have it. It should show only the name. http://192.168.210.215:7778/forms/frmservlet?config=tr like this http://mycompanywebsite First of all tell me is it necessary to create two VIP on different ports and IPs. Is this the right way to do this. How to remove the IP in the URL and it should appear the as a name URL which I wants. Please assist
- Vitaliy_Savrans
Nacreous
Hi Wasim, you don't need to create a new VIP for port 7778. From configuration shown above, I may guess that you need dns record for "mycompanywebsite" corresponding to vip address.
- PeteWhite
Employee
Wasim I think you're confusing HTTP redirect with loadbalancing here - the f5 and the virtual servers and pools act by load balancing ie taking the HTTP traffic on a single IP address and port and sending it to the backed servers, whatever their address and port is. If you want to do redirects, that is something different - this CAN be done via iRules or of course on a server but it's not loadbalancing.
To have a website spread across a number of servers, create a virtual server on the f5 with an IP address (IP address X) and allocate a pool containing web servers (IP address Y). Map the URL to IP address X, the client will connect to this and the loadbalancer will send the traffic on to the relevant backend server.
- Philippe_CLOUP
Employee
Pete point is what i wanted to highlight.
If you use HTTP::redirect, then you are letting the BigIP send the answer to the client, and the traffic is not sent to the server, so no load balancing.
If you want the redirect to hit the correct URI, and use the redirect for that (and then Load balance this), then you just need to remove the port 7778 from your redirect command.
Then, the redirect will be sent to the client, and the client will send a new request with the proper URI, and then you will send it to one or the other pool member.
Be sure to keep the "port translation" cheked to authorize changing port 80 into 7778 by the BigIP.
HTH.
- Philippe_CLOUP
Employee
Pete point is what i wanted to highlight.
If you use HTTP::redirect, then you are letting the BigIP send the answer to the client, and the traffic is not sent to the server, so no load balancing.
If you want the redirect to hit the correct URI, and use the redirect for that (and then Load balance this), then you just need to remove the port 7778 from your redirect command.
Then, the redirect will be sent to the client, and the client will send a new request with the proper URI, and then you will send it to one or the other pool member.
Be sure to keep the "port translation" cheked to authorize changing port 80 into 7778 by the BigIP.
HTH.
- Wasim_Hassan_13
Nimbostratus
Hi, So in netshell i have to modify the irule like this. when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "http://192.168.210.214:/forms/frmservlet?config=tr" } }then VIP will remain on port 80. I did this but i cannot see the webpage now.
Current configuration is like this.
POOL with members and monitor is on 7778. VIP is 192.168.210.214 on port 80. irule is like that
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "http://192.168.210.214:/forms/frmservlet?config=tr" } }I have disabled the second VIP (192.168.210.215 on port 7778). I have even created the dns record but it didnt work. I have already enabled the NAT (automap) because i am running on single arm.
Please let me know.
- Wasim_Hassan_13
Nimbostratus
Hi,
Can anyone assist m, how to fix this URL rewrite issue. My load balancing is working fine on port 7778 on this URL
http://192.168.210.214:7778/forms/frmservlet?config=tr"
but i am not able to do the URL re write.
I want to give user simple URL on port and then want to redirect to the full URL.
http://mycompanywebsite
What to do with the irule to achieve this rule.
- Arie
Altostratus
Does the host "abc" resolve to the IP-address of the VIP where you're running the iRule that does the redirect?
- Wasim_Hassan_13
Nimbostratus
Yes I have host file in test computers for the url Mycompanywebsite
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
