So close to getting Home Assistant proxied - 400 Bad Request

My issue: I am unable to get into my Home Assistant virtual machine on TrueNAS Scale from the NGINX PM App

How I encountered the problem: Connecting through “domain” and it giving me the error: 400: bad request

Solutions I’ve tried:

  • Adding custom config
  • Port forwarding to my router 80:443
  • Removing cache from Chrome and trying Incognito

App Version of NGINX Proxy Manager: 2.13.2

Version of NGINX Proxy Manager: 1.2.18

Deployment environment: TrueNAS Scale as an App/Docker

Source: hub,docker,com/r/jc21/nginx-proxy-manager

Minimal NGINX config to reproduce your issue: nginx.conf
The custom config is at the bottom, but I will also put here:

    server {
      listen 443 ssl;
      server_name home.sommnas.org;
      error_log /var/log/homeassist.log error;
      error_log /var/log/homeassist.log info;
      error_log /var/log/homeassist.log debug;

      # SSL configuration (point to your certificate and key)
      ssl_certificate "/etc/certificates/cert.crt";
      ssl_certificate_key "/etc/certificates/cert.key";

      location / {
        proxy_pass http://192.168.50.33: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 $scheme;

      # WebSocket support
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }

NGINX access/error log: nginx.log

Thoughts:

The closest I have ever gotten was when adding “domain” into the nginx.conf file and adding the SSL certificates. Before that I did not have the SSL certificates and would give me the SSL MISMATCH kind of error from Chrome. Personally I think everything is straightforward, but I’m sure there’s something I am missing.

Hi @TuTOrGames!

Based on the logs it would seem something is indeed funky with SSL. How are you generating your certs? NGINX Proxy Manager is an external tool that is not supported/developed/maintained by us so if you are using some tooling on their end, I would suggest asking in their respective channels. Otherwise, I’d suggest switching to a vanilla NGINX installation and using the NGINX ACME module we launched a few months ago :slight_smile:

Hello,

I am using a ACME DNS Authenticator from within TrueNAS Scale, which I would guess is something NGINX ACME would use as well?

That’s then used for CSR (Certificate Signing Requests) to create certs.

Though the odd thing is; NGINX PM is able to work for my TrueNAS and NGINX PM itself, but not for Home Assistant. I will state that Home Assistant is a virtual machine, while NGINX PM is an App in TrueNAS. Can that have something to do with it?

Doesn’t make sense though because I’ve seen many times you can just point towards the Home Assistant IP (since it’s not technically “connected” on TrueNAS) with the port it uses and it should just direct the domain to that IP and port.

I’m worried if I got vanilla NGINX, it wouldn’t even work at all since it would have it’s own IP as well, maybe messing things up more? IDK.

TrueNAS IP is 192.x.x.7, Home Assistant is 192.x.x.33

EDIT: Also another note: when I had Home Assistant as an App on TrueNAS, it worked. However, I needed Frigate (the NVR) and I had to get Home Assistant on a VM. The IPs did change of course since it’s a VM and not an App.

I feel so so so so so so so so stupid right now…

So when configuring NGINX Proxy Manager as a native App on TrueNAS Scale, it defaults 3 different ports

  • 30020 for WebGUI
  • 30021 for port 80
  • 30022 for port 443

I’m sure very intelligent people will immediately understand why I am specifically mentioning this… but to those who aren’t aware:

I forgot to change the mother fudging ports. That means this ENTIRE TIME (approx. 6 days) that I have been trying to get my domain to work on Home Assistant did NOTHING.

The crazy part is that it would work for TrueNAS and NGINX PM itself, so I thought something was wrong with Home Assistant the entire fricking time.

I just can’t believe something so small managed to waste an immense amount of my time, but damn did I learn so much in that period of time.

1 Like

Glad to hear you figured it out!

In the interest of adding some more info here, NGINX ACME is a module we just launched relatively recently so I doubt it’s been integrated into other tools for now, but of course I might be wrong :slight_smile:

1 Like

Hey @TuTOrGames ! Awesome that you figured it out and learned something. It’s a classic situation to “waste” time on such small things. (That was me yesterday fiddling with a setting on this forum!!)

From one community member to another: you’re not stupid! Anyone trying to use NGINX has real smarts. All of your efforts here to sort it out show creativity, intelligence, and determination :clap: :clap: :clap:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.