users@glassfish.java.net

Re: [webtier] Fwd: JSP request.getRemoteHost() returns IP address instead of host name

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Thu, 24 Sep 2009 09:35:32 -0700

Did you not see my response I sent to dev_at_glassfish yesterday, where
your original
request had been posted?

My reply was as follows:

<reply>
Use the following attribute:

- In GlassFish v2.x:
  http-service.http-protocol.dns-lookup-enabled=true

- In GlassFish v3:
  
network-config.protocols.protocol.http-listener-1.http.enable-dns-lookup=true
</reply>

Jan


On 09/23/09 22:32, Andy Knight wrote:
> Forwarding to additional aliases.
>
> <http://www.sun.com> 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 <mailto:Andy.Knight_at_Sun.COM>
> Blog: http://blogs.sun.com/andky
> <http://www.sun.com>
>
>
> Begin forwarded message:
>
>> *From: *Andy Knight <andy.knight_at_sun.com <mailto:andy.knight_at_sun.com>>
>> *Date: *23 September 2009 15:39:53 GMT+01:00
>> *To: *dev_at_glassfish.dev.java.net <mailto:dev_at_glassfish.dev.java.net>
>> *Bcc: *Andrew Hopkinson <Andrew.Hopkinson_at_Sun.COM
>> <mailto: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?
>>
>> <http://www.sun.com/> 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 <mailto:Andy.Knight_at_Sun.COM>
>> Blog: http://blogs.sun.com/andky
>> <http://www.sun.com/>
>>
>>
>