roles/homeassistant: Add HTTPS redirect
Enforce HTTPS access to Home Assistant web UI using a redirect and HSTS.
This commit is contained in:
@@ -7,7 +7,13 @@ ProxyPass / http://localhost:8123/
|
|||||||
ProxyPassReverse / http://localhost:8123/
|
ProxyPassReverse / http://localhost:8123/
|
||||||
|
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
RewriteCond %{HTTPS} !on
|
||||||
|
RewriteRule /.* https://%{SERVER_NAME}$0 [R=301,L]
|
||||||
|
|
||||||
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
||||||
RewriteRule /(.*) ws://localhost:8123/$1 [P,L]
|
RewriteRule /(.*) ws://localhost:8123/$1 [P,L]
|
||||||
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
|
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
|
||||||
RewriteRule /(.*) http://localhost:8123/$1 [P,L]
|
RewriteRule /(.*) http://localhost:8123/$1 [P,L]
|
||||||
|
|
||||||
|
Header always set \
|
||||||
|
Strict-Transport-Security "max-age=63072000; includeSubDomains"
|
||||||
|
|||||||
Reference in New Issue
Block a user