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

I recently moved my 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 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 instance. This allows me to connect to UI outside my network with my domain address With running on the RPi this was working fine with the following Nginx config:

server {
        listen 443 ssl;


        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 configuration.yaml file looked like this:

  use_x_forwarded_for: true
  trusted_proxies: <nginx host ip address>

After moving 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 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.