users@glassfish.java.net

Fwd: JSP request.getRemoteHost() returns IP address instead of host name

From: Andy Knight <Andy.Knight_at_Sun.COM>
Date: Thu, 24 Sep 2009 06:32:19 +0100

Forwarding to additional aliases.

         Andy Knight
Principal Engineer,
Sun Microsystems, Inc.
Java House, Guillemont Park, Minley Road,
Camberley, Surrey GU17 9QG United Kingdom
Home office: +44 1494 462438
Mobile: +44 7775 583415
Skype: aprknight
Email: Andy.Knight_at_Sun.COM
Blog: http://blogs.sun.com/andky


Begin forwarded message:

> From: Andy Knight <andy.knight_at_sun.com>
> Date: 23 September 2009 15:39:53 GMT+01:00
> To: dev_at_glassfish.dev.java.net
> Bcc: Andrew Hopkinson <Andrew.Hopkinson_at_Sun.COM>
> Subject: JSP request.getRemoteHost() returns IP address instead of
> host name
>
> My research indicates that Tomcat, by default, has a configuration
> parameter called enableLookups. By default this is false. Under such
> circumstances an invocation of request.getRemoteHost() (when the
> host is the localhost) returns 127.0.0.1 (or 0:0:0:0:0:0:0:1%0 if
> you're running Mac OS X).
>
> If I change enableLookups to true, request.getRemoteHost() returns
> the string localhost as expected.
>
> When I deploy my web application to GlassFish and cause the same JSP
> code to run, I get the IP address as I would by default in Tomcat.
>
> How do I configure GlassFish to enable lookups in the way that
> Tomcat behaves?
>
> Andy Knight
> Principal Engineer,
> Sun Microsystems, Inc.
> Java House, Guillemont Park, Minley Road,
> Camberley, Surrey GU17 9QG United Kingdom
> Home office: +44 1494 462438
> Mobile: +44 7775 583415
> Skype: aprknight
> Email: Andy.Knight_at_Sun.COM
> Blog: http://blogs.sun.com/andky
>
>