Antoine Antoine escribió:
Hello Sean,
Did this solution in the proxy balancer posted by rafael worked for you
? because it seems that applying that, I have no authentication anymore
....
Did you find any solution for this problem ?
Regards,
Antoine
Hi Antoine,
When you want protect an application with basic authentication you
need protect the static content (served by apache) and dinamic content
(served by mongrel).
A complete example:
==== foo.conf (vhost config file)
<Proxy balancer://foo_cluster>
BalancerMember http://127.0.0.1:8008
AuthType Basic
AuthName "foo authentication"
AuthUserFile /usr/local/apache2/conf/passwords
Require user bar
</Proxy>
<VirtualHost *:80>
ServerName foo.com
ServerAlias *.foo.com
DocumentRoot /home/foo/current/public
<Directory "/home/foo/current/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
AuthType Basic
AuthName "foo"
AuthUserFile /usr/local/apache2/conf/passwords
Require user bar
</Directory>
RewriteEngine On
# Check for maintenance file and redirect all requests
# ( this is for use with Capistrano's disable_web task )
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !\.
RewriteCond %{REQUEST_FILENAME} (^[^\.]*$)|(.format:js)
RewriteRule ^/(.*)$ balancer://foo_cluster%{REQUEST_URI} [P,QSA,L]
# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/css
# ... text/xml application/xml application/xhtml+xml text/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</VirtualHost>
=== /usr/local/apache2/conf/passwords
passwords file is created:
# htpasswd -c /usr/local/apache2/conf/passwords bar
Add new user:
# htpasswd /usr/local/apache2/conf/passwords baz
--
Rafael Garcia Ortega
begin:vcard
fn;quoted-printable:Rafael Garc=C3=ADa Ortega
n;quoted-printable:Garc=C3=ADa Ortega;Rafael
org:ASPgems S.L.
email;internet:[EMAIL PROTECTED]
tel;work:692686533
x-mozilla-html:FALSE
url:http://www.aspgems.com
version:2.1
end:vcard
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users