For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

gleano's avatar
gleano
Icon for Nimbostratus rankNimbostratus
Mar 05, 2020

irule redirect based on ports

Hello,

 

I need a URL that redirect base on ports.

I have a site called: http://xyz.com

so these URL may look like:

 

http://xyz.com/abc /patron/aaaa/bbbb

http://xyz.com/abc/credit/bbb/aaaa

port 6003

or

http://xyz.com/abc/order/aaa/bbb

http://xyz.com/abc/order/bbb/aaa

port 6004

 

they'll do a post as well get request depending on the request.

 

 

 

when HTTP_REQUEST {  

 set my_host [HTTP::host]

 set my_uri [HTTP::uri] 

 switch -glob [string tolower [$my_uri]] {

  "/abc/virtualcsc/bulkoperation"

{

 HTTP::redirect "$my_host:6001$my_uri"

}  

"/abc/patron"

  {

   HTTP::redirect "$my_host:6003$my_uri"

  }

  "/abc/card"

  {

   HTTP::redirect "$my_host:6004$my_uri"

  }

  "/abc/order"

  {    

   HTTP::redirect "$my_host:6005$my_uri"

  }

"/abc/wallet"

{  

 HTTP::redirect "$my_host:6006$my_uri"

}

"/abc/health"

  {

HTTP::redirect "$my_host:6009$my_uri"

}

"/abc/productcatalog"

{

HTTP::redirect "$my_host:6002$my_uri"

}

"/abc/swagger-ui.html"

{

HTTP::redirect "$my_host:7001$my_uri"

}

 }

 

1 Reply

  • Instate of multiple VIP, you can create multiple pool with different port and add iRule redirection with URI condition. Let me know if you need help in iRule.