Forum Discussion
Gregory_Gerard_
Nimbostratus
Apr 30, 2008Oddities in XForwardedFor?
I'm using Tomcat as a webserver and I've got access logs recording the XForwardedFor header into the log.
The oddity I'm seeing is this:
10.20.108.103,unknown
My internal network is 10/16 but *not* 10.20!.
Why is the LTM not recording the real IP address of the other side which is what I really need in the access log?
For most entries, everything works grand but it's these anomalies that are driving me nuts.
The other puzzler is why the LTM even acknowledges the packet.
10. is not publicly routable and this is coming in off a publicly routed interface. I would presume (perhaps wrongly) the LTM would filter out "funny" traffic.
thank!
- Nicolas_Menant
Employee
Hi,when HTTP_REQUEST_SEND { log local0. "request from [IP::client_addr] with X-FORWARDED-FOR value: [HTTP::header "X-Forwarded-For]" }
- Gregory_Gerard_
Nimbostratus
I will add this to my rules but I'm not sure when it will happen again. - hoolio
Cirrostratus
It's possible that a client or previous network device is inserting an XFF header. It's also possible that the BIG-IP is inserting an invalid value (bug?). nmenant's example should help you determine what's happening. If you get a runtime error from the example when trying to use the HTTP::header command in the HTTP_REQUEST_SEND event, you could try forcing the HTTP::header command into the clientside context using 'clientside {HTTP::header "X-Forwarded-For"}'.when HTTP_REQUEST { Remove all instances of the custom header while {[HTTP::header exists X-Forwarded-For]}{ HTTP::header remove X-Forwarded-For } Insert a new XFF header with the client IP address as a value HTTP::header insert X-Forwarded-For value [IP::client_addr] }
- Gregory_Gerard_
Nimbostratus
Thanks, Hoolio! That's neat. - hoolio
Cirrostratus
The HTTP profile option would just add a new XFF header with the client IP address. It wouldn't touch any existing XFF headers. - Manuel_Rodrigu2
Nimbostratus
Thanks for the quick feedback Hoolio! - hoolio
Cirrostratus
The rule will remove all existing instances of the XFF headers and insert one, so you do not need to enable the XFF option on the HTTP profile.
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