request.getRemoteHost() returns IP address instead of FQDN
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
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
apache-httpd dns tomcat
add a comment |
up vote
1
down vote
favorite
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
apache-httpd dns tomcat
one IP can have many many FQDNs associated with it. What are you trying to accomplish? You may be better off checking PTR records for the IP retrieved (reverse DNS records)
– ivanivan
Dec 3 at 19:06
I'm trying to get ANY hostname. You are correct, I would be better off with reverse dns, but this is a third party application and I cannot modify the source code. I'm just trying to make the existing code work (if it is possible).
– Bill T
Dec 3 at 20:53
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
Dec 3 at 22:55
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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
apache-httpd dns tomcat
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
apache-httpd dns tomcat
apache-httpd dns tomcat
edited Dec 3 at 17:36
Jeff Schaller
37.4k1052121
37.4k1052121
asked Nov 30 at 21:43
Bill T
112
112
one IP can have many many FQDNs associated with it. What are you trying to accomplish? You may be better off checking PTR records for the IP retrieved (reverse DNS records)
– ivanivan
Dec 3 at 19:06
I'm trying to get ANY hostname. You are correct, I would be better off with reverse dns, but this is a third party application and I cannot modify the source code. I'm just trying to make the existing code work (if it is possible).
– Bill T
Dec 3 at 20:53
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
Dec 3 at 22:55
add a comment |
one IP can have many many FQDNs associated with it. What are you trying to accomplish? You may be better off checking PTR records for the IP retrieved (reverse DNS records)
– ivanivan
Dec 3 at 19:06
I'm trying to get ANY hostname. You are correct, I would be better off with reverse dns, but this is a third party application and I cannot modify the source code. I'm just trying to make the existing code work (if it is possible).
– Bill T
Dec 3 at 20:53
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
Dec 3 at 22:55
one IP can have many many FQDNs associated with it. What are you trying to accomplish? You may be better off checking PTR records for the IP retrieved (reverse DNS records)
– ivanivan
Dec 3 at 19:06
one IP can have many many FQDNs associated with it. What are you trying to accomplish? You may be better off checking PTR records for the IP retrieved (reverse DNS records)
– ivanivan
Dec 3 at 19:06
I'm trying to get ANY hostname. You are correct, I would be better off with reverse dns, but this is a third party application and I cannot modify the source code. I'm just trying to make the existing code work (if it is possible).
– Bill T
Dec 3 at 20:53
I'm trying to get ANY hostname. You are correct, I would be better off with reverse dns, but this is a third party application and I cannot modify the source code. I'm just trying to make the existing code work (if it is possible).
– Bill T
Dec 3 at 20:53
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
Dec 3 at 22:55
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
Dec 3 at 22:55
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f485266%2frequest-getremotehost-returns-ip-address-instead-of-fqdn%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
one IP can have many many FQDNs associated with it. What are you trying to accomplish? You may be better off checking PTR records for the IP retrieved (reverse DNS records)
– ivanivan
Dec 3 at 19:06
I'm trying to get ANY hostname. You are correct, I would be better off with reverse dns, but this is a third party application and I cannot modify the source code. I'm just trying to make the existing code work (if it is possible).
– Bill T
Dec 3 at 20:53
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
Dec 3 at 22:55