Forum Discussion
Antonio_Varni
Nimbostratus
Jan 21, 2008replace all instances of a HTTP header
How can I replace all instances of a given header?
Specifically in my case I am trying to remove all previously set X-Forwarded-For headers before having the LTM inject it's own. The X-Forwarded...
TD_DSS_116260
Nimbostratus
Nov 25, 2013I use the below rule and successfully end up with our clients IP address. This will check for any pre-existing XFF, remove it, and then add the IP of the incoming request. It's a bit wasteful (why not just wipe out the XFF regardless of if it is there or not?) though.
when HTTP_REQUEST {
if {[HTTP::header exists X-Forwarded-For]}
{
HTTP::header remove X-Forwarded-For
HTTP::header insert X-Forwarded-For [IP::remote_addr]
} else {
HTTP::header insert X-Forwarded-For [IP::remote_addr]
}}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects