'unable to connect to Home Assistant' when using a external Nginx reverse proxy

I want my Home Assistant be visible on the web by using a second raspberry pi running Ubuntu and nginx reverse proxy. I need the reverse proxy so I can create multiple websites behind one IP address in the future.

I can access Home Assistant on correctly.

The first time I try to connect using mydomain.com I’m presented a Home Assistant login screen, and after putting in my credentials an error appears: ‘Unable to connect to Home Assistant’.

My config of the external ngnix reverse proxy (

server {
        listen 80;
        server_name mydomain.com;
        location / {
                        include proxy_params;

On the Home Assistant I also have a reverse proxy, But uninstalling that, does not solve the problem. The config:

In the configuration.yaml I have added http:

  use_x_forwarded_for: true 

I must be missing something . . . .

How can I access my Home Assistant using an external reverse proxy (but on my LAN), so I can use my domain mydomain.com to access Home Assistant and be able to run other websites in the future? is my Home Assistant running on a raspberry PI 4 is the nginx reverse proxy running on Ubuntu server also on a PI 4