SOLVED: SSL with Home Assistant on docker & Nginx Proxy Manager

SOLVED: After typing this post, I tried one more thing, and enabled Websockets Support in Nginx Proxy Manager, that solved the issue. Leaving this here for future reference.

Hello there,

I hope someone can help me with this.
Searched a lot on google and this forum, but couldn’t find a solution when using Nginx Proxy Manager.

I am running Home Assistant 0.110.7 (Going to update after I have this issue solved)
Next to that: Nginx Proxy Manager
The Nginx Proxy Manager is a great tool for managing my proxy’s and ssl certificates.
I have a domain name setup with most of my containers, they all work fine, internal and external.
But I can’t seem to run Home Assistant using SSL.

Right now, with the below setup, I can access Home Assistant thru local url via https. It gives me the warning that the ssl certificate is not good (because the cert is setup for my external url), but it works.
But, I cannot login on HA thru external url, not locally and not on external internet. I do get the login screen, but when I login, it says Unable to connect to Home Assistant..

I did the following right now:

Docker container setup
I am using docker-compose, and the following is in my compose file (I left out some not-usefull information for readability)

services:
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:0.110.7
    volumes:
      - /home/ubuntu/docker/hass/config:/config
      - ssl:/config/ssl
    network_mode: host

  nginxproxyman:
    container_name: nginxproxyman
    image: jc21/nginx-proxy-manager
    volumes:
      - /home/ubuntu/docker/nginx_proxy_man/config/config.json:/app/config/production.json
      - /home/ubuntu/docker/nginx_proxy_man/data:/data
      - ssl:/etc/letsencrypt

volumes:
  ssl:

By mounting the ssl/letsencrypt folder from the nginx proxy manager into a named volume, I managed to load the ssl files into home-assistant so it can read them.

In my configuration.yaml I have the following setup:

homeassistant:
  internal_url: https://192.168.2.4:8123
  external_url: https://hass.mydomain.nl (Fake name, but you get the point)

http:
  ssl_certificate: /config/ssl/live/npm-12/fullchain.pem
  ssl_key: /config/ssl/live/npm-12/privkey.pem

I get no errors in the home assistant log.
In Nginx Proxy Manager I get my Proxy Host setup which forwards the external url to the https internal url. And using the SSL certificate in folder NPM-12 (Same as linked to home assistant), with Force SSL on.

Does anyone knows what I am doing wrong?
I’d like to continue using Nginx Proxy Manager, because it is a great and easy to use tool.
Sorry for the long post, but I wanted to provide as much information as I can.

3 Likes

Nevermind, solved it.
All I had to do was enable Websockets Support in Nginx Proxy Manager
That did the trick.

I am leaving this here if other people need an answer to this problem.

10 Likes

Thank you!! it works for me… :slight_smile:

Thank you very much!!
I am not using Proxy Manager, i am using swag, but websockets was the hint…

Thanks, I have been try to work this out for ages and this fixed my problem.

Thank you man. This solved my issue as well.

Thank you so much !