Forum Discussion
iRule for Port
We are migrating an internal portal that we have running through the Big IP. I want to write an iRule to redirect users if they try to go to the old page to the new one. The url is the exact same except for the port number.
I am trying to write an http re-redirect if the url contains port 50100 and redirect it to 57701. Not having much luck with it.
elseif {[TCP::local_port] eq 50100}{ log local0. "irj" HTTP::redirect "https://abc.com:57701/irj/portal"
Thanks
2 Replies
Hi Aguley,
if using a single Virtual Server for both ports you need to evaluate the port number to selectivly redirect the request.
if { [TCP::local_port] eq 57701 } then { do nothing } elseif { [TCP::local_port] eq 50100 } then { HTTP::redirect "https://abc.com:57701/irj/portal" }
If using independent Virtual Server for each port you don't need to evalutate the port number. Simply put a...
HTTP::redirect "https://abc.com:57701/irj/portal"
... into the iRule of the Virtual Server listening on port 50100 to redirect every request to the new site.
Cheers, Kai
- StephanManthey
Nacreous
Hi,
I assume your existing virtual server is listening on on TCP/50100 and you have added a new one to listen on TCP/57701. As all new connections to the old virtual server will match the port 50100 anyway you dont need to test the condition. Instead you just add the iRule to it:when HTTP_REQUEST { HTTP::redirect "https://abc.com:57701/irj/portal" return }
The default pool can be removed.
Thanks, Stephan
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