Forum Discussion
rluhrman_127985
Jan 13, 2006Historic F5 Account
Replacing Headers using iRules
I came across an issue where using "replace" did not replace the header with the new header.
Here is an example:
rule WL-Proxy-Client-IP-BAD {
when HTTP_REQUEST {
if { [HTTP::header exists "X-Forwarded-For"] } {
HTTP::header replace "X-Forwarded-For" "WL-Proxy-Client-IP"
}
}
}
My question is: since the iRule was accepted by BigIP, is the syntax correct and this does not work or is the syntax incorrect?
I found a work around:
rule WL-Proxy-Client-IP {
when HTTP_REQUEST {
if { [HTTP::header exists X-Forwarded-For] } {
HTTP::header remove X-Forwarded-For
HTTP::header insert WL-Proxy-Client-IP [IP::client_addr]
}
}
}
I would like to understand why the code above with replace did not work.
Thanks.
RL
- Colin_Walker_12Historic F5 AccountWell, given the examples you listed, it looks as though you may be looking for different functionality than what the HTTP::header replace command gives.
when HTTP_REQUEST { if { [HTTP::header exists "X-Forwarded-For"] } { HTTP::header replace "X-Forwarded-For" "WL-Proxy-Client-IP" } }
when HTTP_REQUEST { if { [HTTP::header exists "X-Forwarded-For"] } { HTTP::header replace "X-Forwarded-For" [IP::client_addr] } }
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