ProxyPass, Apache and reverse DNS hostname lookups

Submitted by jay on 10 March, 2010 - 14:42

Ran into an interesting and frustrating performance problem with a site at work today. Any OSX or derivative system (iPhone, iPod, or laptop/workstation) was seeing extremely poor performance when visiting a site using Tomcat 6 and Apache's mod_proxy (specifically mod_proxy_ajp) with a couple ProxyPass and ProxyPassReverse directives.

Searching around a little I finally found this helpful post that seemed to describe the problem users were experiencing:
http://betabug.ch/blogs/ch-athens/933

On my Linux systems performance was excellent. Apache wasn't doing any HostName lookups since any machine I tried had a valid rDNS entry. Enter OSX devices, which just don't seem to get along.

Changing the ProxyPass directives to use a numeric IP instead of localhost as the hostname did the trick.

Before:

ProxyPass /url ajp://localhost:8080/url
ProxyPassReverse /url ajp://localhost:8080/url

After:

ProxyPass /url ajp://127.0.0.1:8080/url
ProxyPassReverse /url ajp://127.0.0.1:8080/url

That despite having a valid /etc/hosts file, and despite having served up other sites on the same server with no problems for a couple months. Strange..

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.