Allow use of ports other than 8123 in HA (#2307)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
This commit is contained in:
Felipe Santos
2021-12-22 13:51:10 -03:00
committed by GitHub
parent 455a992805
commit 21215aa9d0
4 changed files with 10 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
# Changelog
## 3.1.0
- Allow use of ports other than 8123 in Home Assistant Core
## 3.0.2
- Update Alpine to 3.14

View File

@@ -1,4 +1,5 @@
version: 3.0.2
version: 3.1.0
hassio_api: true
slug: nginx_proxy
name: NGINX Home Assistant SSL proxy
description: An SSL/TLS proxy

View File

@@ -58,7 +58,7 @@ http {
#include /share/nginx_proxy_default*.conf;
location / {
proxy_pass http://homeassistant.local.hass.io:8123;
proxy_pass http://homeassistant.local.hass.io:%%HA_PORT%%;
proxy_set_header Host $host;
proxy_redirect http:// https://;
proxy_http_version 1.1;

View File

@@ -13,6 +13,8 @@ KEYFILE=$(bashio::config 'keyfile')
CERTFILE=$(bashio::config 'certfile')
HSTS=$(bashio::config 'hsts')
HA_PORT=$(bashio::core.port)
# Generate dhparams
if ! bashio::fs.file_exists "${DHPARAMS_PATH}"; then
bashio::log.info "Generating dhparams (this will take some time)..."
@@ -52,6 +54,7 @@ fi
sed -i "s#%%FULLCHAIN%%#$CERTFILE#g" /etc/nginx.conf
sed -i "s#%%PRIVKEY%%#$KEYFILE#g" /etc/nginx.conf
sed -i "s/%%DOMAIN%%/$DOMAIN/g" /etc/nginx.conf
sed -i "s/%%HA_PORT%%/$HA_PORT/g" /etc/nginx.conf
[ -n "$HSTS" ] && HSTS="add_header Strict-Transport-Security \"$HSTS\" always;"
sed -i "s/%%HSTS%%/$HSTS/g" /etc/nginx.conf