I am using Netscape Enterprise Edition 6.01 and attempting to access a Javaapplet. Some machines are able to see the site using a hostname (myserver) while others can only resolve it using the IP address. However, I have noticed that even though a user enters the IP address in the browser URL, a servlet calling the getServerName() method of HttpServletRequest returns the hostname of the machine (myserver). My question is how do common webservers implement the getServerName() method. I have found that some use the Host request-header value passed by the browser. Is there a way to determine what my browser is passing for this header field? Thanks
I have had similar problems, specifically with Apache forwarding requests to Tomcat. Apache wasn't sending the requested host name through to Tomcat, which was then using the local machine hostname rather than the name the client requested. will return the host name requested by the client, IF it was set by the browser. If the browser doesn't set that header then I don't think there is anything you can do.
subject: Implementation of getServerName in web servers