Forum Moderators: phranque
Here is an annoying one.
I have checked /etc/httpd/conf/httpd.conf
and:
HostnameLookups Off
All my other domains are fine but this 1 domain keeps doing DNS lookups and it's causing the site to take several seconds to load anything :(
Does anyone know why this might be? I know it is doing reverse DNS because it's the only log file that shows hostnames instead of IP addresses.
Thanks for your help guys
My site uses an .htaccess:
=================================
order allow,deny
deny from some_ip_address
allow from all
=================================
Simply by commenting those lines out Apache has stopped doing reverse lookups for that domain.
Why is that and what is the real/proper/permanent fix?
Thanks guys
Be aware that if you use any directives like "Deny from example.com" anywhere on your site, that rDNS lookups will be invoked, regardless of the HostnameLookups setting. This behaviour is required in order to support hostname Denies in mod_access, and is documented for the HostnameLookups directive:
Regardless of the setting, when mod_access is used for controlling access by hostname, a double reverse lookup will be performed. This is necessary for security. Note that the result of this double-reverse isn't generally available unless you set HostnameLookups double. For example, if only HostnameLookups on and a request is made to an object that is protected by hostname restrictions, regardless of whether the double-reverse fails or not, CGIs will still be passed the single-reverse result in REMOTE_HOST.
It sounds like it might be this behaviour, or the result of not really turning off HostnameLookups completely, either because the HostnameLookups is in a different <VirtualHost> container, exists in multiple places, or hasn't been updated by a server restart.
Jim
I wish it was that simple :(
When I said domain I meant as in the website/domain that was having the problem. .htaccess really just has an IP address
I have checked in the vhost file too and Hostlookups is not even shown at all. I even manually added it and turned it off and restarted Apache with the same results.