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

Rosieodonell_16's avatar
May 13, 2018

Add a custom "X-forwarded-for" header

Hey Everyone,

I currently have my F5 sitting in front of an older load balancer. My organization needs to encrypt the traffic between the F5 and the webserver. Because of this, the older load balancer can no longer insert a "x-forwarded-for" value into the header because the traffic is encrypted.

So i was hoping to add an irule that replaces or inserts a "x-forwarded-for" value of 10.102.2.53. I was looking at this irule:

when HTTP_REQUEST {
    HTTP::header remove "X-Forwarded-For"
    HTTP::header replace "X-Forwarded-For" [IP::client_addr]
}

But i need the IP::client_addr to be 10.102.2.53. Any little bit of help would be appreciated. Thanks everyone!

2 Replies

  • You can use this line in iRule:

     

    HTTP::header replace "X-Forwarded-For" "10.102.2.53"

     

    or you can erase/insert this header in http profile:

     

    Request Header Erase

     

    Request Header Insert

     

  • This is the code I ended up going with! Thanks to the community for all the help like always!

     

    when HTTP_REQUEST {
        HTTP::header remove "X-Forwarded-For"
        HTTP::header replace "X-Forwarded-For" [IP::client_addr]
         HTTP::header replace "X-Forwarded-For" 10.102.22.53
    }