How to do HTTP basic auth through a reverse proxy ?

On the back-end apache server, enable a basic auth in your apache server:

<Directory /web/space>
  AuthUserFile /out/of/web/space/htpasswd
  AuthGroupFile /dev/null
  AuthName "Identify"
  AuthType Basic
  <Limit GET POST>
    require valid-user
  </Limit>
</Directory>

Then create your /out/of/web/space/htpasswd file:

htpasswd -c /out/of/web/space/htpasswd back-end_login

Then on the reverse proxy, you can force a basic auth HTTP authentication just by adding a specific header (you need mod_headers):

RequestHeader set Authorization "Basic XXXXX"

XXXXX can be calculated this way using a simple shell command:

echo -n "back-end_login:back-end_password" | base64

Then when accessing the proxyfied server the client will not have to authenticate because the reverse proxy will do it itself.

Discussion

Enter your comment
 
 
 

Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki