basic auth across multiple subdomains

7,076

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).

Share:
7,076
gnur
Author by

gnur

Updated on September 18, 2022

Comments

  • gnur
    gnur almost 2 years

    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
    
  • gnur
    gnur about 13 years
    Yeah, the amount of subdomains is expected to grow to at least 100 as well, but the solution does work. Even though in the end we decided to go for ip based authentication (192.168.*.*) always gets access and some dedicated IP's, for the rest basic auth that needs you to resign in every subdomain..