Forum Discussion
Will_12716
Nimbostratus
Jul 17, 2008Site Redirect with Irule
We have a situation that requires us to redirect traffic to a different port than port 80.
For example, we need to take any requests to http://www.mysite.com and redirect to http://www.mysite.com:9901/MRBS/
It is setup on websphere in a cluster.
We have a virtual server that load balances to two servers.
- hoolio
Cirrostratus
If you configure a pool with the IP address(es) of the server(s) and create a VIP with port translatio enabled, LTM will translate the port from the VIP port to the pool member port automatically. If you want to rewrite the URI, you can use the HTTP::uri command. If you want to redirect the client, you can use HTTP::redirect. - Will_12716
Nimbostratus
The port translation was enabled but noticed we did not have the virtual server responding on port 80. I made that change and it worked. Now we are having this issue: - brice
Nimbostratus
I would try the following. You might want to think about redirecting from service.mysite.com to www.mysite.com/SHCM, and not service.mysite.com/SHCM, but I have created the rule so both host and uri are very portable. The key is using "contains" instead of "equals" I think. See below...when HTTP_REQUEST { set uri [HTTP::uri] set host [HTTP::host] if { [HTTP::host] contains "service.mysite.com" } { set uri "SHCM" } HTTP::respond 301 Location "http://$host$uri" }
- Andy_Herrman_22
Nimbostratus
Oh, one other comment, directed to brices21: - Will_12716
Nimbostratus
We are getting there but not yet. - Andy_Herrman_22
Nimbostratus
The redirect should end up causing a new connection to the same VIP, so my guess is that the VIP isn't configured to use the pools properly (maybe port translation isn't setup right?). - Will_12716
Nimbostratus
We fixed the issue. - Brian_Moore_603
Nimbostratus
man, I tried this iRule and the LTM will not take it... I get an error... - hoolio
Cirrostratus
I would guess you have a simple syntax error. Can you post the rule you're testing? It looks like the rule changed from when you posted previously with the one that you're seeing an error with.
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