request.getRemoteHost() returns IP address instead of FQDN

The name of the pictureThe name of the pictureThe name of the pictureClash 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.



  1. In Apache Tomcat's server.xml I have set enableLookups="true"

  2. 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










share|improve this question























  • 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














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.



  1. In Apache Tomcat's server.xml I have set enableLookups="true"

  2. 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










share|improve this question























  • 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












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.



  1. In Apache Tomcat's server.xml I have set enableLookups="true"

  2. 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










share|improve this question















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.



  1. In Apache Tomcat's server.xml I have set enableLookups="true"

  2. 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
















  • 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















active

oldest

votes











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay