Re: Apache web host name resolution question
From: Ed Marsh (edmarsh_at_email.com)
Date: Fri, 09 Jul 2004 15:00:23 -0500
The browser is Netscape (7.x, if memory serves). The actual flow is very
simple. The HTML page lacated in the html web page directory simply
provides a form which is filled out and than "submits" the form data to
a PHP routine located in the same directory. I assume that the browser
(or server) decides to fully qualify the name of the PHP path name using
the server name (FQDN) and then attempts to resolve the name - thus, it
begins to query the DNS servers, times out, then begins to query a few
other servers like yahoo.
I found the "smart" domain guessing option you mentioned and when I get
home, I will see if that solves my problem.
David Efflandt wrote:
> On Fri, 09 Jul 2004 11:54:12 -0500, Ed Marsh <firstname.lastname@example.org> wrote:
>>I have just setup Apache web server, PHP, MySQL and PostgreSQL on my
>>Fedora Core II system. When writing some HTML pages which call remote
>>PHP routines, I noticed a long delay before the branched call to the PHP
>>routine completes. I snooped the network and noticed that the web
>>server is trying to resolve my server's hostname by going to the
>>external DNS server. After this fails it resubmits the request to Yahoo
>>and a few other lookup servers - fails, and then comes right back to my
>>home gateway router where it directs the call back to the IP address of
>>my Linux Apache server (where it should have been originally). The
>>delay is about 90+ seconds or so. I am trying to do some performance
>>testing, so this is not acceptable.
>>I thought that the Apache web server would follow the instructions of
>>the /etc/nsswitch.conf file and check the local /etc/hosts file first to
>>resolve the hostname before using DNS, but this is apparently not the
>>case. I suspect that I am going to have to set up a local domain in my
>>private network and a proxy server to keep intranet queries local.
>>However, I am hoping that I am wrong and someone has a simplier solution.
> It could be your browser (which one?) that is using DNS and search first
> before /etc/hosts. Some have a built-in DNS cache, or attempt to search
> for a name. I know when I used to netscape, it thought that
> http://localhost/ was an incomplete FQDN and would attempt to search for
> localhost, and come up with localhost.com (a registered domain), which of
> course would not have the local resource I was looking for. That feature
> (Smart Search?) can be diasbled.
> I do not know how you construct those PHP URLs, but perhaps using
> HTTP_HOST from env and/or changing UseCanonicalName to off in apache may
> help, so your browser would use the name that worked (from Host header)
> instead of the server's set or assumed ServerName. But since you say
> "remote" PHP you may need to do something more if accessed from LAN
> or internet (maybe SSI or other dynamic content).