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

puluck's avatar
puluck
Icon for Cirrus rankCirrus
Sep 15, 2016

irule for custom header

Hello All,

 

I have requirement ,where F5 need to insert custom header before load balance the traffic .Client will connect on http port ,but traffic will be sent to port 81 on backend pool for one VIP and for another VIP client connect on http port and traffic will be send to http port on backend pool .

 

Cusomter header will be X-Origin-Port-80 or X-Origin-Port-81

 

Thanks

 

1 Reply

  • Hi Puluck,

    ... if you need to insert the X-Origin-Port header into the request send to your backend application use the code below...

     

     

    when HTTP_REQUEST_SEND {
        clientside {
            HTTP::header replace "X-Origin-Port" [TCP::remote_port]
        }
    }
    

     

    ... if you need to insert the X-Origin-Port header into the responses send to your clients you may use this code...

     

    when HTTP_RESPONSE {
        HTTP::header replace "X-Origin-Port" [TCP::remote_port]
    }
    

     

    Note: I've changed the header name to "X-Origin-Port" and placed the Port into the header value section. This makes much more sense for me. Well, if the header name must be "X-Origin-Port-80/81" then use HTTP::header replace "X-Origin-Port-[TCP::remote_port]" "1", since a HTTP header MUST always have a value to become fully RFC compliant.

    Cheers, Kai