Home Assistant hangs behind Nginx with no error messages (SOLVED)

Hi

I have been running my Home Assistant so it was accessible from a external URL (say example.co.uk) with certbot add in dealing with the https and the alexa working. However I’ve been trying to set up a Nginx server to run a website from my home internet connection, so I’m trying to move my HomeAssistant behind it. Nginx will now deal with the HTTPS.

I believe I’ve done everything I need to have the websockets collectly forwards and I’ve changed my configuration.yaml to accept a proxy and listed the IP address as trusted. I’ve also cleared my cache, updated everything and done restarts. Both Nginx and Home Assistant aren’t logging any errors. I can log in fine on my local ip address (say 192.168.1.1:8123) but when I try from https:\example.co.uk I hang at the logo:

Screenshot from 2024-05-09 16-17-58

The only errors I can see is from my web browser, picture of those attached.

Any idea on anything I can try, and methods for getting more information on the problem?

My Nginx config file:

server {
        server_name example.co.uk www.example.co.uk; # managed by Certbot
        proxy_buffering off;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                proxy_pass http://192.168.01.01:8123;
                proxy_set_header Host $host;
                proxy_redirect http:// https://;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $connection_upgrade;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/example.co.uk/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/example.co.uk/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

        error_log /var/log/nginx/hass_error warn;
        access_log /var/log/nginx/hass_access;
}

my configuration.yaml includes:

http:
  use_x_forwarded_for: true
  trusted_proxies:
   - 192.168.41.2

Answering my own question, the following should not me in the Nginx config file:

try_files $uri $uri/ =404;

this comand atempt to find the requested URL first as a file in the Root directory, then as a folder in the root directory and if it is not found the last part returns a 404 error. Which is what I was getting. I want to pass the query on to my home assistant and I don’t expect the files to be on my server, so it should not be there! It was copied in from some other example file!

Hope that helps someone