Forum Discussion
Surya_89113
Nimbostratus
Feb 25, 2010how to get Source IP address
I have a specific ip pool through which i'll access the
vs and i want my pool under the VS to show the ip addres of actual source instead of LB is there any possible irule for that??
Kindly help
6 Replies
- The_Bhattman
Nimbostratus
Hi Surya,
You can create an irule that will log the client ip address on the LTMwhen CLIENT_ACCEPTED { log local0. "This is the clients up address [IP::client_addr]" }
Let me know if this answers your question
Bhattman - Surya_89113
Nimbostratus
basically i want to store that source ip into a variable so that i can pass it to my web server - The_Bhattman
Nimbostratus
Hi Surya,
If you have HTTP profile setup on the VIP then you can enable X-Forwarded-For insertion on that HTTP profile. This allows LTM to pass the original client IP in a custom HTTP header in requests to the pool members which, in your case, happen to web servers.
Of course the webservers will need to look for that particular header.
Bhattman - hoolio
Cirrostratus
As CB suggests, you can configure LTM to insert the original client IP address it receives in the X-Forwarded-For header. SOL4816 details this and configuring the web server to log this:
SOL4816: Using the X-Forwarded-For HTTP header to preserve the original client IP address for traffic translated by a SNAT
https://support.f5.com/kb/en-us/solutions/public/4000/800/sol4816.html
Aaron - Emilio_104473
Nimbostratus
Is there an irule that can insert xff only if one is not present. In other words I don't want to append to an existing x-forwarded-for header. - Hamish
Cirrocumulus
Just insert a quick check before doing the addition of a header to see if it already exists...
What I often found useful was to pull the current value, and APPEND the new XFF value to an already existing one. Then when you get chained proxies, you still get all the information (Since ofthen if the user is behind a proxy you'll see their original address in the XFF, not the address that your LTM sees).
H
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