• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Can I turn on X-Forwarded-For in local Tomcat 6?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 5559
143
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This needs to be turned on in Apache, not in Tomcat (which merely reports the value sent by Apache).
 
Christopher Swearingen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Tim Moores
Saloon Keeper
Posts: 5559
143
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!