in Hacking

Apache Authentication and Mongrel Cluster

Currently I'm running a mongrel cluster for my rails application. This works much nicer then the FastCGI version.
There was only one problem, I had an .htaccess file to restrict access to the public directory.


AuthName "Somewhere"
AuthType Basic
AuthUserFile /home/nobody/.htpasswd
Require valid-user

The problem was I needed to enter this login data 2 times.
Well after doing some google research I found out the problem was the location of the authorizationcode. I think the .htaccess file is used by every Process of the ProxyBalancer... But I'm not sure...

The solution for this problem was to place the authorization code in the proxy balancer:



BalancerMember http://rails_site:5532
BalancerMember http://rails_site:5533
AuthName "Somewhere"
AuthType Basic
AuthUserFile /home/nobody/.htpasswd
Require valid-user

That's all ;-)