Basic auth across multiple subdomains

apache-2.2http-basic-authenticationwildcard-subdomain

I'm setting up a basic test environment to test drive multiple sites I co-maintain with a colleague.

What I am trying to achieve is to password protect the entire domain with basic auth. This is working, but the problem is that for every subomain you need to reauth yourself. Which, to say the least, is pretty annoying since there are at least 30 subdomains in use at the moment.

Is it possible to transfer the basic auth session across multiple subdomains?

I know I can try to rewrite it all to use a different kind of auth but basic auth is a lot easier to set up.

I am using apache and these are the rules I am using for basic auth:

AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /svn/authz
Require valid-user

Best Answer

These answers provide a way to share authentification across multiple subdomains: Apache .htaccess trick to authenticate only once for all subdomains? and https://stackoverflow.com/questions/339244/using-apaches-mod-auth-across-multiple-sub-domains-for-single-sign-on

However the subdomains have to be listed explicitely, it won't work with wildcards (which is frustrating because I have a domain with 350+ subdomains I would like to share authentification for).

Related Topic