#Hi guys I would like to know if you have

1 messages ยท Page 1 of 1 (latest)

half otter
#

What's in the HA (core) logs?
What's in your NGINX logs?

molten trellisBOT
#

@spice tusk Please use a code share site to share code or logs, for example:

Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.

half otter
#

Images of text are horrible, please don't do that

spice tusk
#

Okay sorry i do that

half otter
#

Also, using Reply in a thread is annoying, if you must please turn the notifications off

spice tusk
#

I got it. Excuse me

#

Nginx access.log:

185.224.128.141 - - [09/Aug/2023:15:57:29 +0200] "GET / HTTP/1.1" 301 169 "-" "Hello World"
192.168.1.254 - - [09/Aug/2023:15:59:00 +0200] "GET / HTTP/1.1" 400 16 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
192.168.1.254 - - [09/Aug/2023:15:59:01 +0200] "GET /favicon.ico HTTP/1.1" 400 16 "https://haos-habsheim.noacco.fr/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom```

**Nginx error.log:**
*Nothing*
#

HA core logs:

Log Details (ERROR)
Logger: homeassistant.components.http.forwarded
Source: components/http/forwarded.py:125
Integration: HTTP (documentation, issues)
First occurred: 4:02:35 PM (2 occurrences)
Last logged: 4:02:35 PM

Received X-Forwarded-For header from an untrusted proxy 192.168.1.252```
half otter
#

You should fix that ๐Ÿ˜‰

spice tusk
#

Oh my god thank you, you've saved me an afternoon, I've been at it for 3 hours. ๐Ÿฅฒ
Sorry again for the screenshots and pings above, I'll find out a bit more about the rules...

#

Have nice day

half otter
#

Any time something doesn't work, the logs should be the first place to look ๐Ÿ˜‰

spice tusk
#

๐Ÿ˜…

#

Well, apparently the redirection works correctly, but when I connect via my url, I get the home asisstant logo displayed with the message

Unable to connect to Home Assistant.
Retrying in 60 seconds...
Retry Now

I have no logs displayed in home assistant

half otter
#

And you have access logs iin NGINX?

spice tusk
#

Nope, i've nothing

half otter
#

Then it's not even reaching NGINX

spice tusk
#

oh wait

#

my bad

#
server@boxisex808:/var/log/nginx$ sudo cat access.log
192.168.1.254 - - [09/Aug/2023:16:26:31 +0200] "GET / HTTP/1.1" 200 3084 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
192.168.1.254 - - [09/Aug/2023:16:26:31 +0200] "GET /api/websocket HTTP/1.1" 400 66 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
192.168.1.254 - - [09/Aug/2023:16:26:31 +0200] "GET /manifest.json HTTP/1.1" 200 933 "https://haos-habsheim.noacco.fr/lovelace" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
192.168.1.254 - - [09/Aug/2023:16:26:33 +0200] "GET /service_worker.js HTTP/1.1" 304 0 "https://haos-habsheim.noacco.fr/service_worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"```
half otter
#

That 400 looks bad ๐Ÿ˜‰

#

What does your NGINX config look like?

spice tusk
#
server {
  listen 80;
  server_name haos-habsheim.noacco.fr;
  return 301 https://haos-habsheim.noacco.fr$request_uri;
}

server {
  listen   *:443;
  server_name  haos-habsheim.noacco.fr;

  # allow large uploads of files
  client_max_body_size 1G;

  # optimize downloading files larger than 1G
  #proxy_max_temp_file_size 2G;

  ssl on;
  ssl_certificate /etc/letsencrypt/live/haos-habsheim.noacco.fr/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/haos-habsheim.noacco.fr/privkey.pem;

  location / {
    # Use IPv4 upstream address instead of DNS name to avoid attempts by nginx to use IPv6 DNS lookup
    proxy_pass http://192.168.1.251:8123;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto "https";
  }
}
half otter
#

Hmmm....

#

You appear to be missing websocket support

#

Enable that, and maybe consider switching to a more modern proxy server that doesn't require you to do that ๐Ÿ˜›

spice tusk
#

Hmm ok I'll look into it...
However, I'm using nginx and it's up to date. What do you recommend as a reverse proxy?

half otter
#

I like Traefik, but I run most software in Docker and that makes it trivial to set up

#

Bonus points because it handles LetsEncrypt certificate renewal itself too