I'm running a Java application on Apache. I'm trying to find a way to allow my app server code to know the hostname of the web server. Is there a way to do this?
Running
InetAddress addr = InetAddress.getLocalHost();
String hostname = addr.getHostName();
or
(HttpServletResponse)response.getHeader("Host");
both predictably yield the app server's hostname.