I have a clean Windows and XAMPP installation. I'm using openHAB. Because openHAB doesn't support Authentication and SSL, I'm using Apache to handle this.
After many hours of work I got everything working exception one thing...
What I want:
1.) localhost, IP/Hostname of Server or my dyndns domain should redirect to openHAB Web UI with SSL and Basic Auth -> That's working!
2.) https://ip/test/ instead should open C:\xampp\htdocs\test\index.php without Basic Auth and only from a specific IP -> That's NOT working!
My httpdc-vhosts.conf:
- Code: Select all
<VirtualHost *:80>
Alias /.well-known/acme-challenge/ C:/xampp/htdocs/.well-known/acme-challenge/
<Directory "C:/xampp/htdocs/.well-known/acme-challenge/">
Options None
AllowOverride None
ForceType text/plain
RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"
</Directory>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
ProxyPreserveHost On
ServerName XXX.XXX.XXX
# 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
RequestHeader set X-Forwarded-Proto "https" env=HTTPS
Header add Set-Cookie "X-OPENHAB-AUTH-HEADER=true;path=/;Secure"
Alias /test C:/xampp/htdocs/test
<Directory C:/xampp/htdocs/test/>
Options Indexes
AllowOverride AuthConfig Limit
Order deny,allow
Deny from all
Allow from x.x.x.x
</Directory>
ProxyPass /test !
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
<Location />
Require expr %{REQUEST_URI} =~ m#^/test/.*#
Header add Authorization ""
Order allow,deny
Allow from all
AuthType Basic
AuthName "Username and Password Required"
AuthUserFile C:\xampp\apache\conf\extra\.htpasswd
Require valid-user
</Location>
SSLCertificateFile C:\Certbot\live\xxxxxxx\cert.pem
SSLCertificateKeyFile C:\Certbot\live\xxxxxxx\privkey.pem
SSLCertificateChainFile C:\Certbot\live\xxxxxxx\chain.pem
</VirtualHost>
I tried so many things. I tried Allow,Deny, I tried require ip, I tried it with .htaccess file. No matter what I do, https://server/test/ is always available for ANY ip, instead of only the specified ip.
Any ideas?