Hi guys,
I really dont know what I should try next…
Problem:
My HA runs in a docker container on my raspi 4 with the optimized pi4 image.
I can access the HA webui with the local ip address of the raspberry. (192.168.178.34:8123)
Then I used my already working nginx container to forward the home assistant webui to the www.
This worked for a few days and suddelny stopped working for me.
On every device I tried accessing the HA WebUI: “Loading Data…” until it says “Unable to connect to Home Assistant.”
Google Chromes inspect tool gives me:
The FetchEvent for "https://ha.xxx.dev/lovelace" resulted in a network error response: the promise was rejected.
Promise.then (async)
(anonymous) @ workbox-routing.prod.js:1
workbox-strategies.prod.js:1 Uncaught (in promise) no-response: no-response :: [{"url":"https://ha.x.dev/lovelace","error":{}}]
at o.makeRequest (https://ha.x.dev/frontend_latest/workbox-v4.1.1/workbox-strategies.prod.js:1:3983)
n @ workbox-core.prod.js:1
makeRequest @ workbox-strategies.prod.js:1
2service_worker.js:1 Uncaught (in promise) TypeError: Failed to fetch
core.7580321d.js:1 POST https://ha.xxx.dev/auth/token net::ERR_CONNECTION_TIMED_OUT
i @ core.7580321d.js:1
refreshAccessToken @ core.7580321d.js:1
u @ core.7580321d.js:1
h @ core.7580321d.js:1
(anonymous) @ core.7580321d.js:1
Promise.then (async)
179 @ core.7580321d.js:1
r @ core.7580321d.js:1
(anonymous) @ core.7580321d.js:1
(anonymous) @ core.7580321d.js:1
The FetchEvent for "https://ha.xxx.dev/manifest.json" resulted in a network error response: the promise was rejected.
Promise.then (async)
(anonymous) @ workbox-routing.prod.js:1
workbox-strategies.prod.js:1 Uncaught (in promise) no-response: no-response :: [{"url":"https://ha.xxx.dev/manifest.json","error":{}}]
at c.makeRequest (https://ha.xxx.dev/frontend_latest/workbox-v4.1.1/workbox-strategies.prod.js:1:3260)
n @ workbox-core.prod.js:1
makeRequest @ workbox-strategies.prod.js:1
/manifest.json:1 GET https://ha.xxx.dev/manifest.json net::ERR_FAILED
core.7580321d.js:1 WebSocket connection to 'wss://ha.xxx.dev/api/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
e @ core.7580321d.js:1
(anonymous) @ core.7580321d.js:1
u @ core.7580321d.js:1
h @ core.7580321d.js:1
(anonymous) @ core.7580321d.js:1
lovelace:1 Uncaught (in promise) 1
Accessing the HA inside the local network still works.
What I already tried to fix the issue:
- changed the nginx config a thousand times -> never had success
- used the official Home Assistant Doc on how to set up the nginx as reverse proxy -> same issue
- deleted ./storage/ dir -> same issue
- restarted the raspberry and docker container 1000x -> same issue
- tried adding the proxy as a “trused_proxy” in the configuration.yaml -> same issue
- tried fiddling around with the configuration.yaml with http entries i.e. adding the proper certificate, etc.
Here are important snippes of my config files:
NGINX config:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name xxx.dev;
location / {
return 301 https://$host$request_uri;
}
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
}
server {
server_name ha.xxx.dev;
ssl_certificate /etc/letsencrypt/live/ha.xxx.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ha.xxx.dev/privkey.pem;
ssl_dhparam /etc/nginx/ssl/dhparams.pem;
listen [::]:443 ssl default_server ipv6only=off;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
# ssl_session_cache shared:SSL:10m;
proxy_buffering off;
location / {
proxy_pass http://192.168.178.34:8123;
proxy_set_header Host $host;
proxy_redirect http:// https://;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
(keep in mind: this already worked a few days and suddenly stopped working)
docker-compose.yml (HA):
version: '3.7'
services:
homeassistant:
container_name: homeassistant
image: homeassistant/raspberrypi4-homeassistant:latest
network_mode: "host"
ports:
- "8123:8123"
volumes:
- ./config:/config
# - /docker/certbot/data/certbot/conf/live/ha.xxx.dev/:/certs #(was an fixing attempt)
- /etc/localtime:/etc/localtime:ro
- /etc/letsencrypt:/etc/letsencrypt:ro
# devices:
# - /dev/ttyACM0:/dev/ttyACM0:rwm
restart: always
configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
http:
base_url: https://ha.xxx.dev
# trusted_proxies=["192.168.178.34/24", "127.0.0.1"]
use_x_forwarded_for: true
trusted_proxies: 127.0.0.1
# Text to speech
tts:
- platform: google_translate
#group: !include groups.yaml
automation: !include automations.yaml
#script: !include scripts.yaml
#scene: !include scenes.yaml
sonoff:
username: <mymail>
password: !secret sonoff
api_region: 'eu'
tuya:
username: <mymail>
password: !secret smartlife
country_code: 49
platform: smart_life
hacs:
token: e...7
Do you have ideas to solve my problem with HA?