request.getRemoteHost() returns IP address instead of FQDN
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
New contributor
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
New contributor
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
yesterday
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
yesterday
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
yesterday
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
New contributor
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
New contributor
New contributor
edited yesterday
Jeff Schaller
37k1052121
37k1052121
New contributor
asked Nov 30 at 21:43
Bill T
112
112
New contributor
New contributor
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
yesterday
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
yesterday
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
yesterday
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
yesterday
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
yesterday
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
yesterday
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
yesterday
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
yesterday
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
yesterday
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
yesterday
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
yesterday
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Bill T is a new contributor. Be nice, and check out our Code of Conduct.
Bill T is a new contributor. Be nice, and check out our Code of Conduct.
Bill T is a new contributor. Be nice, and check out our Code of Conduct.
Bill T is a new contributor. Be nice, and check out our Code of Conduct.
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
yesterday
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
yesterday
Check this forum post out - particularly the part about the RFC that defines the HTTP connection stuff... coderanch.com/t/81745/application-servers/…
– ivanivan
yesterday