[mod_python] HostNameLookups

Evert Carton evert_carton at yahoo.co.uk
Sun Sep 26 03:49:10 EDT 2004

Hi all,

[mod_python 3.1.3 on Linux, Apache 'prefork']

I'm having this little problem with hostname lookups.

I have HostNameLookups turned on in Apache, and I have an entry for a
given host both in the hosts file and in DNS. The hostname for the
IP-address can be resolved. I checked all that.

Since things didn't work as expected, I've put in some debugging code
(including printing the PID of the Apache child-process), and it looks
like mod_python thinks hostname resolution has not been done
(req.connection.remote_host = None). However, when I do a simple refresh
of the page, the hostname shows up fine.

When I go back to the page a little later, (in order to 'try' to talk to
a different Apache child-process, the problem returns: hostname does not
look like its been resolved ... page refresh and all is well ...

Go to a different virtualhost on the same IP (same Python code): problem
returns ... refresh ... all is well ...

Looking at the Apache access-log (and error-log), it seems like it has
always been doing hostname lookup just fine.  

Restarted Apache a few times, didn't help ;-)

Help ? Please ;-)
Kind Regards,

More information about the Mod_python mailing list