I need to be able to read request.getHeader("X-Forwarded-For") for web app I'm working on. Currently the Tomcat 6 server, running on my local machine, reports null. Is it possible to turn this on in Tomcat 6? How? I'm a total newb at administering Tomcat/Apache.
This needs to be turned on in Apache, not in Tomcat (which merely reports the value sent by Apache).
posted 7 years ago
Tim Moores wrote:This needs to be turned on in Apache, not in Tomcat (which merely reports the value sent by Apache).
OK.... so is this possible on a local version of Tomcat/Apache? We're using RTC which is just Eclipse with IBMisms. Again I'm a newb to Apache so I don't even know where to begin. If it's possible I'm assuming a configuration file somewhere? My setup is at C:\tomcat\ and there is a \conf directory that contains a server.xml. Right area?
No, those files/directories are all for the Tomcat. This header needs to be enabled in the Apache httpd web server that's in front of the Tomcat. At least that's how I understood your setup to be - is that correct?
If there is no Apache httpd, then you don't need to use this header - the remote IP you get from the HttpServletRequest should be the correct one.