The servlet API spec reads as follows: getLocalAddr public java.lang.String getLocalAddr()The default behavior of this method is to return getLocalAddr() on the wrapped request object. Specified by: getLocalAddr in interface ServletRequest Returns: a String containing the IP address on which the request was received. Since: 2.4 I tracked down the bug to the following code: Http11AprProcessor.java The action() method which is called with ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE assings a hostname instead of an ip address to the localAddr variable 1050: localAddr = addr.hostname; which then sets it in the request object 1058: request.localAddr().setString(localAddr);
*** This bug has been marked as a duplicate of 37673 ***
Created attachment 17076 [details] Simple JSP demonstrating the bug This JSP demonstrates the bug clearly. It has both request.getLocalName() which should return the local server's hostname. It also has request.getLocalAddr() which returns the machines hostname, it should return the local server's IP address. Open the .jsp in Tomcat 5.5.12 using the APR native connector.