My company has recently installed some hardware-based load balancers. Among other things, these load balancers provide a caching proxy for our web applications.
As soon as those went into production, some of our web applications started having problems in obtaining the client IP address. (These were web apps that had reason to check such things.)
This served as a nice reminder that a web application should not trust the client IP address to be accurate. Most ISPs run all web traffic through a proxy, and you never know how many proxies a request will go through before hitting your server.
The proper way to get the client ip address is to use the X-Forwarded-For header.
Now, the X-Forwarded-For header may contain multiple ip addresses. In this case, it will contain a comma-separated list of addresses. The client ip address is the first one in the list.
X-Forwarded-For 172.17.150.97, 18.104.22.168
172.17.15.97 is the actual client ip address
22.214.171.124 is a proxy server
For more information on X-Forwarded-For, see this Wikipedia Article
For those who haven’t found it yet, there is a fantastic Java News Podcast called the Java Posse. The authors are good about putting out a new episode nearly every week. They give an entertaining mix of Java-related news, interviews and random ramblings that helps me to stay on top of the latest trends. The episodes are typically right at 45 minutes in length which makes them perfect for my commute.
Give them a listen at: http://www.javaposse.com/
I’m often asked for help in setting up the eclipse IDE and specifically, which plug-ins to use.
Here’s a list of my “Essential” plug-ins that help complete my eclipse experience:
- Open External:
My new replacement for Eclipse Platform Extensions.¬† Adds Open in Command Prompt and Open in Explorer options to the context menu.
Site Update URL: http://update.eclipsegeek.com(Down as of 7/2009)
Temporary Update Site: http://update2.pragmatic.kr
Sourceforge.net Project Site:http://sourceforge.net/projects/eclipse/
Author’s Site: http://pragmatic.kr/pages/2077012
- FindBugs plugin:
FindBugs does static analysis on your code and searches for thousands of known error patterns. This tool is amazing! I’ve started using it as a precursor to any code review. Get this, use it, and start writing better code today!
Site Update URL: http://findbugs.cs.umd.edu/eclipse/
- Maven2 Plugin:
Ok, so we don’t use Maven here yet, but when we start, this plugin will be very helpful. It manages the POM file for you, but the coolest thing is that it will automatically mount all of your project dependencies in eclipse. Just simplifies the whole experience.
Site Update URL: http://m2eclipse.codehaus.org/update/
Update: Looks like there’s a new Update URL: http://m2eclipse.sonatype.org/update/
This version of the Maven plug-in complains about needing a jdk.¬† To fix this add the following to eclipse.ini:
- Perforce Plugin:
Of course, this one’s necessary. Makes it seamless to work with Perforce
Site Update URL: http://www.perforce.com/downloads/http/p4-wsad/install/
- SQL Explorer Plugin:
Not quite as nice as the Stand-Alone SQL Developer tool from Oracle, this is a handy plug-in for Eclipse that lets you run queries against the database.
Site Update URL: http://eclipsesql.sourceforge.net/
- Eclipse Web Platform Tools
Adds nice JSP, XML, and other editors to Eclipse. You can find this on the Eclipse website. I don’t have an update URL for it.
This is a nice Catch-All syntax highlighting editor that covers syntax for most everything. It’s handy to have for those random source files that you don’t already have another plug-in for.
No Site Update URL, you have to download their Jar and install it into eclipse manually.
- QuickRex Regular Expression Builder
This is a nice tool for building and testing regular expressions. I’ve used stand-alone tools in the past, but it’s certainly nice to have this right in eclipse. It provides a field for creating a regular expression and another field for entering a block of text to test against. Matches are hilighted as you type, making it easy to get things right.
Subclipse is a Team provider for the Subversion.
Version 1.2 of subclipse is at:
Version 1.6 of subclipse is at:
These are the plugins that I use day to day in eclipse and just make my life easier. If you have more favorites, please include them in the comments.