diff --git a/roles/homeassistant/defaults/main.yml b/roles/homeassistant/defaults/main.yml index f342d82..14c5f7e 100644 --- a/roles/homeassistant/defaults/main.yml +++ b/roles/homeassistant/defaults/main.yml @@ -4,3 +4,4 @@ homeassistant_ssl_certificate: >- homeassistant_ssl_certificate_key: >- {{ apache_ssl_certificate_key }} homeassistant_proxy_zwavejs2mqtt: true +homeassistant_proxy_zigbee2mqtt: true diff --git a/roles/homeassistant/templates/homeassistant.httpd.conf.j2 b/roles/homeassistant/templates/homeassistant.httpd.conf.j2 index a849ef6..f263726 100644 --- a/roles/homeassistant/templates/homeassistant.httpd.conf.j2 +++ b/roles/homeassistant/templates/homeassistant.httpd.conf.j2 @@ -26,6 +26,17 @@ RewriteRule /.* https://%{SERVER_NAME}$0 [R=301,L] 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] + + RequestHeader set X-External-Path /zigbee + + ProxyPassReverse /zigbee/ http://localhost:8080/ +{% endif %} RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /(.*) ws://localhost:8123/$1 [P,L]