Forum Discussion
x-forward-for irule
Hello Friends,
I have configured x-forward-for irule on my F5 and also it is enabled on HTTP profile. but it seems its not working cause on Apache server, we are getting only value of self IP, but not end client IP. I dont know why?
below is the script we have on Apache server
LogFormat "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" combined_forwarded
SetEnvIfNoCase X-Forwarded-For "." from_proxy=1
CustomLog /appl/liferay/logs/http-access.log combined env=!from_proxy
CustomLog /appl/liferay/logs/http-access.log combined_forwarded env=from_proxy
this script works well, when we access application without F5, but do not work when, connects to application via F5
Irule configured on F5 is
when HTTP_REQUEST { HTTP::header insert "X-Forwarded-For" [IP::client_addr] }
can someone suggest if any changes in Irule required to work with above apache sript?
- Leonardo_39231Nimbostratus
I'm sure someone will correct me if I'm wrong but I don't believe you want the quotes(") around X-Forwarded-For.
Try this:
when HTTP_REQUEST { HTTP::header insert X-Forwarded-For [IP::client_addr] }https://devcentral.f5.com/wiki/iRules.XForwardedForSingleHeaderInsert.ashx
- Leonardo_39231NimbostratusIf you want this turned on for all of your http traffic you can also turn on "x-forwarded for" in the http profile, there should be a drop-down box to enable it on the http profile.
- Kalpesh_48932NimbostratusHello Leonardo,
- Leonardo_39231NimbostratusKalpesh,
- Kevin_StewartEmployeeA few things to consider.
- Kalpesh_48932NimbostratusHello,
- Kevin_StewartEmployeeAssuming traffic to the server is not encrypted, try a TCPDUMP. Something like this:
tcpdump -lnni 0.0 -Xs0 [filter of your choice to limit view]
Recent Discussions
Related Content
* 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