• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7590
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7590
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic