cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

irule redirect based on ports

gleano
Nimbostratus
Nimbostratus

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 1

Samir
Nacreous
Nacreous

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.