I am using the homeassistant supervised container set, and I can access it from my LAN without any issue: I just point my browser to http://raspberrypi:8123 ans everything works.
My setup is the following:
I have my router forwarding port 444 to 443 (so, from the internet, I am accessing https://myfqdn.org:444)
I have an nginx server already running for other purposes, and I want to use that as a SSL termination point for the connections comming from the internet. In this case, the configuration of nginx is
server {
listen 443 ssl default_server http2;
server_name myfqdn.org;
# enable TLS
ssl on;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers "ECDH+AESGCM DH+AESGCM ECDH+AES256 DH+AES256 ECDH+AES128 DH+AES ECDH+3DES DH+3DES RSA+AESGCM RSA+AES RSA+3DES !aNULL !MD5 !DSS";
# Enable HSTS (HTTP Strict Transport Security) for half a year
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload";
# set the certificates
ssl_certificate /etc/letsencrypt/live/myfqdn.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myfqdn.org/privkey.pem;
# enable OCSP stapling to speed up first connect
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/myfqdn.org/chain.pem;
# Diffie-Hellman parameter for DHE ciphersuites
ssl_dhparam /etc/nginx/tls/private/dhparam.pem;
# Enable session resumption
ssl_session_cache shared:SSL:30m;
ssl_session_timeout 1d;
# Set several headers
proxy_hide_header X-Powered-By;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
location / {
proxy_pass http://127.0.0.1:8123;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_buffering off;
}
}
Finally, in /usr/share/hassio/homeassistant/configuration.yaml, I have added the following section:
(The reason for using the 172.30.32.0/23 is because my docker interface is sitting in 172.30.32.1/23). I have also changed the configuration in nginx, just in case, so that the line
if you go that route, you have to use proper json. What you have is not proper json. An IP is not a number, therefore it needs to be wrapped in quotes.
Right, I corrected that thank you! I am still getting this issue, but I think I have made some progress:
if on a laptop on the local network, I set an entry in /etc/hosts file to resolve myfqdn.org to the ip of the raspberrypi, I can connect from the laptop to homeassistant using https… everything works.
if I connect using that same laptop, without any modification to /etc/hosts, to myfqdn.org:444 it does not work.
Then, seems that the problem is caused by my router forwarding external 444 port to 443 in the nginx server. Does this make any sense?