I am designing a servlet in which I would like to determine the fully qualified domain name (FQDN) of the client. I am attempting to use javax.servlet.HttpServletRequest.getRemoteHost() in order to get the hostname. When running the application on Apache Tomcat as a standalone server, request.getRemoteHost() works as I would hope, returning the FQDN of the client. However, when running the application with the Apache Httpd server as a frontend and mod_jk as the connector, request.getRemoteHost() always returns the ip address of the client instead of the FQDN.
I have tried the following two configuration options in an attempt to solve this problem.
- In Apache Tomcat's server.xml I have set enableLookups="true"
- In Apache Httpd's httpd.conf, I have set HostnameLookups On
Still request.getRemoteHost() returns the client's ip address instead of it's FQDN.
Is there a configuration option that will allow my servlet's request.getRemoteHost() method return the client's FQDN when running Apache Tomcat with Apache Httpd, as it does when it is running with just Apache Tomcat?
My environment is RHEL 7.5 with Apache Httpd server 2.4.6 and Apache Tomcat 8.5