Forum Discussion

justin_schauf_3's avatar
justin_schauf_3
Icon for Nimbostratus rankNimbostratus
Nov 03, 2017

Multiple port redirection with an iRule

I have 2 servers I need to be able to reddirect 1 virtual server to and am having trouble with the iRule. Here is my iRule

 

when HTTP_REQUEST {

 

if { [HTTP::uri] equals "/" } {

 

HTTP::redirect "http://[HTTP::host]/subfolder/Default.html"

 

}

 

}

 

My 2 nodes are on different ports on each server. The irule redirects like this.

 

http://server.net/subfolder/Default.html:30005

 

I need it to send it to this.

 

http://server.net:30005/subfolder/Default.html

 

Thanks for any assistance in advance.

 

  • The pool consists of 2 members, each with a different port. * server1.net:30004 * Server2.net:30005 Do I need to do something different with the irule or with how the members/nodes are configured?

     

  • a redirect is something else then a load balancing action. a redirect changes the client request it will in principle not get you on one of the servers directly but on the virtual server again. on what port is the virtual server listening?

     

    you want to load balance to either of the two pool member and change the URI?

     

  • Yes, that's right. URI change is the best option. Redirect will take connection back to VIP with different port no.