Can’t connect to Home assistant from internet anymore. Started a new install and still get the same error.
From outside i can reach home assistant but land on the login page with: Error: Something went wrong
I get nothing in the logs, but when i inspect the page i get 2 errors:
Failed to load resource: the server responded with a status of 500 () →
Error starting auth flow SyntaxError: Unexpected token ‘<’, “
<h”… is not valid JSON
Here’s my setup:
Reverse proxy (swag): Runnning in Docker (ubuntu)
Home Assistant (HAOS): Runing in a VM (virtual box)
Swag proxy conf:
(I replaced the end of my machine IP with XXX)
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name homeassistant.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
# enable for ldap auth (requires ldap-location.conf in the location block)
#include /config/nginx/ldap-server.conf;
# enable for Authelia (requires authelia-location.conf in the location block)
#include /config/nginx/authelia-server.conf;
# enable for Authentik (requires authentik-location.conf in the location block)
#include /config/nginx/authentik-server.conf;
location / {
# enable the next two lines for http auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
# enable for ldap auth (requires ldap-server.conf in the server block)
#include /config/nginx/ldap-location.conf;
# enable for Authelia (requires authelia-server.conf in the server block)
#include /config/nginx/authelia-location.conf;
# enable for Authentik (requires authentik-server.conf in the server block)
#include /config/nginx/authentik-location.conf;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app 192.168.1.XXX;
set $upstream_port 8123;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
location ~ ^/(api|local|media)/ {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app 192.168.1.XXX;
set $upstream_port 8123;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}
Home Assistant Configuration Yaml:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
http:
use_x_forwarded_for: true
trusted_proxies:
- 192.168.1.0/24
- 172.28.0.0/16
If you ever stumble on my post, i fixed it. Problem was due to my setup also using Crowdsec, with recaptcha. CAPTCHA or Appsec are do not support http2 requests, and as of 5/1/2024 it’s not fixed yet.
More details about the problem:
So what’s the fix ?
If you still want to use Captcha or AppSec you need to remove http2 from your proxy conf files.
If your not using Captcha or Appsec make sure they’re not in youre docker yml file.