Forum Discussion

155's avatar
155
Icon for Nimbostratus rankNimbostratus
Jun 22, 2020

iRule insert IP::remote_addr to uri redirect

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

  • 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's avatar
    155
    Icon for Nimbostratus rankNimbostratus

      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?