-1

I have a Ubuntu 20.04 LTS Server with a set of virtual host configurations that protect a group of subdomains using basic auth, for example lets say secure.example.com is password protected as well as www.secure.example.com, sub.secure.example.com and www.sub.secure.example.com however my issue is that it asks you to reauthenticate every time you change subdomain for example if you go from secure.example.com to www.secure.example.com it will ask you to reauthenticate which is not desired how do I make it so that authentication is valid for a certain set of subdomains so you only have to authenticate once for this set of subdomains?

Example VirtualHost configuration:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName secure.example.com
    ServerAlias www.secure.example.com
    DocumentRoot /var/www/secure.example.com/public_html

    <Directory /var/www/secure.example.com/public_html/>
        AuthName "Restricted Content"
        AuthType Basic
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user

        Options Indexes FollowSymLinks
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

1 Answers1

0

Basic authentication passes the password with every request. Allowing the browser to reuse the entered password for a different host would be a massive security risk.

So no, that is not possible.

Simon Richter
  • 3,317
  • 19
  • 19