This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get the computer name of the client

 
Clarke Kent
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I need to get the computer name of the machine who initiated a request.

The application is running on a company intranet.
I tried to use request.getRemoteHost(), but that function returns the actual name if im not using a proxy.. When I am using a proxy, the name of the proxy is returned and not the actual computer name.

regards,

Clarke
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If they're behind a proxy, you're not going to get that name.
 
Clarke Kent
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yea, thats what I thought

But, is there a way to communicate with the proxy, to ask the proxy to get the name/address of the actual computer who made the request? an API or something?

regards,

clarke
 
Morgan Christian
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically no.

A proxy is usually setup for a couple of reasons:

to cache internet traffic for speed enhancements or to watch 'usage'... outgoing requests from the proxy to the internet are all from the same host or small collection of hosts. The proxies themselves will not respond to your name resolution requests.

Check out http://www.squid-cache.org/ If you'd like to get a better understanding of the what/why/where of a proxy.
[ January 06, 2006: Message edited by: Morgan Christian ]
 
Don Morgan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If having the name of the computer is critical to your application and you really need it on the server side, one option would be to simply ask the user to enter it and then pass it along as a parameter to your servlet.

I don't know if there is any way of automating this (such as running a piece of javascript which would populate a hidden field for you with their machine's name.)
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends. If you use Web Proxy servers then there will be proprietary property which will store the original client IP. In general you can take a look at X-Forwarded-For property.

If you are using WebLogic Proxy plugin then there is a property like WL-Proxy-Client-IP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic