OH3 Apache Reverse-proxy Authentication Fails Unauthorized access

My working apache configuration with OH3.1

<IfModule mod_ssl.c>
<VirtualHost *:443>
	ProxyPreserveHost On
	ServerName openhab.mydomain.com

	 # Cross-Origin Resource Sharing
    Header add 'Access-Control-Allow-Origin' '*'
    Header add 'Access-Control-Allow_Credentials' 'true'
    Header add 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'
    Header add 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'

	ProxyTimeout 3600
    RequestHeader unset Authorization
	Header add Set-Cookie "X-OPENHAB-AUTH-HEADER=true;path=/;Secure"
    
	<Location />
        
        Header add Authorization ""
        ProxyPass http://localhost:8080/
        ProxyPassReverse http://localhost:8080/
        Order allow,deny
        Allow from all

        AuthType Basic
        AuthName  "Username and Password Required"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Location>


SSLCertificateFile /etc/letsencrypt/live/openhab.mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/openhab.mydomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

4 Likes