Forum Discussion
irule for X-Forwarded-For
Hi All,
I got one request for tracking the real IP in server side. I have enabled X-Forwarded-For in http profile, but the user still facing some trouble. I checked few documents and got to know that we can configure X-Forwarded-For from irule as well.
when HTTP_REQUEST { HTTP::header insert X-Forwarded-For [IP::client_addr] }
I have already configured one irule in the VIP. So my query is that is it possible to add script (mentioned above) in the existing irule. I cannot replaced the irule because it is using for many purpose.
- Amanpreet_SinghCirrostratus
Hi SJoshi, Although enabling X-Forwarded-For in HTTP profile will do the same thing as you do with mentioned iRule statement .If still you want to have that controlled via iRule, you can do that by creating a NEW iRULE and assign that to VS. Keep existing iRULEs untouched.
When you have more than one iRULE associated with any VS, LB process these iRULEs individually once by one in top down approach.
/Aman
Yes this should be possible. You can add it to the existing irule or add it together with the other irule. You can add more than one irule to a virtual server.
Hi,
I recommend to remove possible existing X-Forwarded-For before inserting a new one :
when HTTP_REQUEST { HTTP::header remove "X-Forwarded-For" HTTP::header insert "X-Forwarded-For" [IP::client_addr] }
You can also include the code below in an existing irule :
HTTP::header remove "X-Forwarded-For" HTTP::header insert "X-Forwarded-For" [IP::client_addr]
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