Forum Discussion

mbkosiba_310067's avatar
mbkosiba_310067
Icon for Nimbostratus rankNimbostratus
Jun 06, 2017

Replace X-Forwarded-For value with client IP

I am trying to remove an existing X-Forwarded-For field in an HTTP header with my actual client IP address via an iRule. Currently, I have a VS configured with a HTTP profile and code in the iRule that is supposed to remove existing XFF entries and replace it with a XFF entry containing my actual client IP address however whenever I use a chrome extension to spoof a made up IP value and put it in the XFF field, the iRule is not stripping the value and replacing it. The code I am trying to use is this:

 

when HTTP_REQUEST { HTTP::header remove X-Forwarded-For

 

HTTP::header insert X-Forwarded-For [IP::remote_addr] }

 

however I have been working on this a few days now and have used probably 10 different variations of the similar code found across different dev central articles, none of which seem to touch the XFF field. I'm not sure anything on the F5 is actually touching the XFF field and the spoofing tool I'm using is the only thing able to actually insert into the header. I really just want something that can remove any current XFF fields and insert the actual client IP into the XFF field.

 

Any help would be greatly appreciated. Support hasn't been able to help with me on this.

 

2 Replies