We would like to identify and display the server and port that a Java application is running on that is behind a proxy web server. This means that getServerName() and getSer
The server hostname is part of the request, as it depends on what URL the client used to reach your host. The value you get in this way is defined on the client and does not have to be what you expect.
If you are interested in the local hostname, you can try:
String hostname = InetAddress.getLocalHost().getHostName();