Site Network: Personal | Professional | Photography

Technical Blog

This blog will contain content related to Java, Seam, Security, my sites and projects, as well as other technical subjects I am interested in.

Comments and questions are welcome!

Getting the Real IP Address from a Proxied Request in ATG

Many things can obscure the real IP address of the end user when they visit your site: a load balancer in front of your ATG cluster, Akamai, the user's ISP or office network, and more. This makes correlating logging events, or using the ATG session IP validation security option, and more, very difficult. In light of that challange I've added a new mini-module to my Open Source ATG Modules called the ProxyIPFixer. It uses a simple ATG pipeline Servlet to examine the X-FORWARDED-FOR request header, and if it finds one, parse through the IP addresses to find the originating IP address of the user, and puts that value into the ATG Request object's remoteAddr property.

This allows downstream pipeline servlets, code, and pages to see the real user's IP address.

The caveat is that the header can be faked, and that some ISPs/companies, such as AOL, do not set the true end point of the user, and you can only see back to their outgoing proxy server. In AOL's case in particular, they can also route subsequent requests by the same AOL user through different AOL proxy points, which will make it appear that someone is hijacking a session (if you're using the ATG session security mechanism). So be aware of the limitations. However it can be very useful.

For those who don't want to download the whole module package, I have attached the Java source and the ATG properties file to this post.

Enjoy! (and as always feel free to contact me with questions, issues, improvements, etc...)

ProxyIPFixerServlet Java Source

ProxyIPFixer ATG Properties File

3 Responses to “Getting the Real IP Address from a Proxied Request in ATG”

  1. keif Says:

    I’m curious why you don’t enable social bookmarking/digging/etc. on your blog entries. I’m definitely bookmarking this.

  2. Devon Says:

    Honestly, because I don’t use social bookmarking sites myself. Do you know of a Wordpress plugin for that you’d recommend? I googled and found several, but would love a recommendation.

  3. links for 2008-04-10 | iKeif Says:

    [...] stuff pulled off in Action Script)browser development dhtml interval javascript programming webdev Getting the Real IP Address from a Proxied Request in ATG | Devon Hillard Tech Blog 12 hours, 49 minutes agoDevon shows how to get the REAL IP address using ATGatg code java [...]

Leave a Reply