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 insert IP::remote_addr to uri redirect

155
Nimbostratus
Nimbostratus

Hi,

 

In our scenario, we have public-facing URL https://domain.com. I need to receive traffic from that url and forward it to one of the pool nodes as below:

https://subdomain.[IP::remote_addr].com:9000. I understand how to do basic http redirect but I can't figure out how to concat/insert pool member's ip address into the redirect uri.

2 REPLIES 2

youssef1
Cumulonimbus
Cumulonimbus

Hello,

 

For your need you have to set your hostname in LB_SELECTED event when the backend server will be selected:

 

when LB_SELECTED { HTTP::header replace Host "subdomain.[LB::server addr].com" log local0. "serverIP $serverIP" log local0. "Host: [HTTP::header value Host]" }

So you don't need to insert the port, this one will be redirect automaticly (by default in your VS the Port Translation is checked).

 

kee p me in touch if you need more details.

 

regards.

155
Nimbostratus
Nimbostratus

  Thanks for the reply! I didn't know about LB_SELECTED. So, I did what you suggested but when I navigate to https://domain.com and seems to just pass the traffic alone to one of pool members without doing redirect to https://subdomain.[IP::remote_addr].com.

Do I need to include and other options in that iRule like HTTP redirect?