Files
configpolicy/roles/homeassistant/templates/homeassistant.httpd.conf.j2
Dustin C. Hatch a670e34e90 r/homeassistant: Proxy for Zigbee2MQTT frontend
Zigbee2MQTT now has a web GUI, which makes it *way* easier to manage the
Zigbee network.  Now that I've got all the Philips Hue bulbs controlled
by Zigbee2MQTT instead of the Hue Hub, having access to the GUI is
awesome.
2022-12-12 17:47:05 -06:00

49 lines
1.6 KiB
Django/Jinja

RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule /.* https://%{SERVER_NAME}$0 [R=301,L]
<VirtualHost _default_:443>
ServerName {{ homeassistant_server_name }}
SSLCertificateFile {{ homeassistant_ssl_certificate }}
SSLCertificateKeyFile {{ homeassistant_ssl_certificate_key }}
SSLCertificateChainFile {{ homeassistant_ssl_certificate }}
ProxyPreserveHost On
ProxyRequests Off
RewriteEngine on
{% if homeassistant_proxy_zwavejs2mqtt %}
RewriteRule ^/zwave$ /zwave/ [R=301,L]
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /zwave/(.*) ws://localhost:8091/$1 [P,L]
RewriteRule /zwave/(.*) http://localhost:8091/$1 [P,L]
# ZwaveJS2Mqtt doesn't respect X-External-Path for the logo URL
RewriteRule ^/static/logo\.png$ http://localhost:8091$0 [P,L]
<Location /zwave>
RequestHeader set X-External-Path /zwave
</Location>
ProxyPassReverse /zwave/ http://localhost:8091/
{% endif %}
{% if homeassistant_proxy_zigbee2mqtt %}
RewriteRule ^/zigbee$ /zigbee/ [R=301,L]
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /zigbee/(.*) ws://localhost:8080/$1 [P,L]
RewriteRule /zigbee/(.*) http://localhost:8080/$1 [P,L]
<Location /zigbee>
RequestHeader set X-External-Path /zigbee
</Location>
ProxyPassReverse /zigbee/ http://localhost:8080/
{% endif %}
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:8123/$1 [P,L]
RewriteRule /(.*) http://localhost:8123/$1 [P,L]
ProxyPassReverse / http://localhost:8123/
Header always set \
Strict-Transport-Security "max-age=63072000; includeSubDomains"
</VirtualHost>