Reverse Proxy (Nginx) Connection not Working After Moving Hass.io from RPi to Docker

I recently moved my Hass.io from running on a Raspberry Pi to running on Docker on an Ubuntu server following the Alternative section of this guide. The transition has gone smoothly except for the reverse proxy connection to my Hass.io instance no longer working.

I have a Nginx running on a separate Docker container (using the linuxserver/letsencrypt container) on the same Ubuntu host server as I now am running the Hass.io instance. This allows me to connect to Hass.io UI outside my network with my domain address https://homeassistant.mydomain.com. With Hass.io running on the RPi this was working fine with the following Nginx config:

server {
        listen 443 ssl;

        server_name homeassistant.mydomain.com;

        include /config/nginx/ssl.conf;

        client_max_body_size 0;

        location / {
                proxy_set_header Host $host;
                proxy_redirect http:// https://;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_buffering               off;
                proxy_ssl_verify              off;
                proxy_pass http://<raspberry ip address>:8123;
        }
}

The http section in my Hass.io configuration.yaml file looked like this:

http:
  base_url: https://mydomain.com
  use_x_forwarded_for: true
  trusted_proxies: <nginx host ip address>

After moving Hass.io from the RPi to Docker on the Ubuntu host server I would have thought it was just a simple matter of changing the IP address in the proxy_pass section of the Nginx configuration to the IP address of the host server (or localhost since its the same host), however this did not work. All I get when using the same URL is a 502 Bad Gateway response from the Nginx.

I also tried changing trusted_proxies parameter in the Hass.io configuration.yaml file to localhost IP, but this had no effect. I have tried to Google my way to an answer, but I do not have much experience with Nginx from before and am a bit stuck with this issue. Any help I much appreciated.