[GH-ISSUE #1056] Error 502 - Bad gateway - Connection reset by peer) while reading response header from upstream #884

Closed
opened 2026-02-26 06:34:48 +03:00 by kerem · 1 comment
Owner

Originally created by @redtripleAAA on GitHub (May 2, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1056

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    Yes
  • Are you sure you're not using someone else's docker image?
    Yes

Describe the bug

  • A clear and concise description of what the bug is.
    Getting Error 502 - Bad gateway - Connection reset by peer) while reading response header from upstream
    When using network service mode of two containers in a single docker compose stack

  • What version of Nginx Proxy Manager is reported on the login page?
    v2.8.1 © 2019 jc21.com

To Reproduce
Here is the stack I have that is not working


################################################################################################
version: "3.7"

services: 
  gluetun-Mullvad: 
    cap_add: 
      - NET_ADMIN
    container_name: gluetun-Mullvad
    environment: 
      - PUID=1029
      - PGID=100
      - TZ=America/Toronto
      - VPNSP=mullvad
      - PORT=443
      - COUNTRY=Canada
      - CITY=Montreal
      - PORT_FORWARDING=on
      - OPENVPN_USER=$$$$$$$$$$$$$$$$$$ #Change to YOUR Username
      - FIREWALL_VPN_INPUT_PORTS=55939 #ca-mtr-55939 PORT MULLVAD
      - PROTOCOL=tcp
      - OPENVPN_IPV6=off
    image: qmcgaw/gluetun
    ports: 
      - "8002:8000"
      - "8228:80" #8228:80 -- lab-ansred-bootstrap container
    volumes: 
      - "/volume1/docker/gluetun/gluetun-Mullvad/config:/gluetun"
################################################################################################
  web: 
    container_name: lab-redmedia-bootstrap
    image: nginx
    network_mode: "service:gluetun-Mullvad"
    volumes: 
      - "/volume1/docker/Bootstrap/redrice/:/usr/share/nginx/html:ro"
################################################################################################

Expected behavior
To launch the web service GUI through the proxy hostname

Operating System
Synology NAS DSM'
Docker
Portainer

Additional context
I have another host that is working fine almost same setup
I can access the container without issues using private IP + Port internally ( http://10.0.12.16:8228 ) but not through proxy manager

Logs
From:
/config/log/error.log

Not working

2021/05/02 00:09:04 [error] 6890#6890: *965978 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.17.0.1, server: lab.hamra.services, request: "GET / HTTP/1.1", upstream: "http://10.0.12.16:8228/", host: "lab.example.com"

2021/05/02 00:09:05 [error] 6890#6890: *965980 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.17.0.1, server: lab.example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://10.0.12.16:8228/favicon.ico", host: "lab.example.com", referrer: "https://lab.example.com/"

Working VPN port

2021/05/02 00:10:18 [warn] 6890#6890: *966648 an upstream response is buffered to a temporary file /var/tmp/nginx/proxy/9/71/0000073719 while reading upstream, client: 172.17.0.1, server: netdata.example2.com, request: "GET /static/js/main.98cc989e.chunk.js HTTP/2.0", upstream: "http://10.0.12.16:19999/static/js/main.98cc989e.chunk.js", host: "netdata.example2.com", referrer: "https://netdata.example2.com/"

2021/05/02 00:10:19 [warn] 6889#6889: *966650 an upstream response is buffered to a temporary file /var/tmp/nginx/proxy/0/72/0000073720 while reading upstream, client: 172.17.0.1, server: netdata.example2.com, request: "GET /static/js/2.274a88e3.chunk.js HTTP/1.1", upstream: "http://10.0.12.16:19999/static/js/2.274a88e3.chunk.js", host: "netdata.example2.com", referrer: "https://netdata.example2.com/"

From:
/config/log/proxy_host-63.log

[01/May/2021:16:09:53 +0000] - 502 502 - GET http lab.example1.com "/" [Client 172.17.0.1] [Length 154] [Gzip -] [Sent-to 10.0.12.16] "Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.163 Mobile/15E148 Safari/604.1" "-"

[02/May/2021:00:09:04 +0000] - 502 502 - GET https lab.example1.com "/" [Client 172.17.0.1] [Length 556] [Gzip -] [Sent-to 10.0.12.16] "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" "-"

Please let me know what you think.

Thanks in advance!

Originally created by @redtripleAAA on GitHub (May 2, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1056 **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? Yes - Are you sure you're not using someone else's docker image? Yes **Describe the bug** - A clear and concise description of what the bug is. Getting Error 502 - Bad gateway - Connection reset by peer) while reading response header from upstream When using network service mode of two containers in a single docker compose stack - What version of Nginx Proxy Manager is reported on the login page? v2.8.1 © 2019 jc21.com **To Reproduce** Here is the stack I have that is not working ``` ################################################################################################ version: "3.7" services: gluetun-Mullvad: cap_add: - NET_ADMIN container_name: gluetun-Mullvad environment: - PUID=1029 - PGID=100 - TZ=America/Toronto - VPNSP=mullvad - PORT=443 - COUNTRY=Canada - CITY=Montreal - PORT_FORWARDING=on - OPENVPN_USER=$$$$$$$$$$$$$$$$$$ #Change to YOUR Username - FIREWALL_VPN_INPUT_PORTS=55939 #ca-mtr-55939 PORT MULLVAD - PROTOCOL=tcp - OPENVPN_IPV6=off image: qmcgaw/gluetun ports: - "8002:8000" - "8228:80" #8228:80 -- lab-ansred-bootstrap container volumes: - "/volume1/docker/gluetun/gluetun-Mullvad/config:/gluetun" ################################################################################################ web: container_name: lab-redmedia-bootstrap image: nginx network_mode: "service:gluetun-Mullvad" volumes: - "/volume1/docker/Bootstrap/redrice/:/usr/share/nginx/html:ro" ################################################################################################ ``` **Expected behavior** To launch the web service GUI through the proxy hostname **Operating System** Synology NAS DSM' Docker Portainer **Additional context** I have another host that is working fine almost same setup I can access the container without issues using private IP + Port internally ( `http://10.0.12.16:8228` ) but not through proxy manager **Logs** From: `/config/log/error.log` Not working ``` 2021/05/02 00:09:04 [error] 6890#6890: *965978 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.17.0.1, server: lab.hamra.services, request: "GET / HTTP/1.1", upstream: "http://10.0.12.16:8228/", host: "lab.example.com" 2021/05/02 00:09:05 [error] 6890#6890: *965980 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.17.0.1, server: lab.example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://10.0.12.16:8228/favicon.ico", host: "lab.example.com", referrer: "https://lab.example.com/" ``` Working VPN port ``` 2021/05/02 00:10:18 [warn] 6890#6890: *966648 an upstream response is buffered to a temporary file /var/tmp/nginx/proxy/9/71/0000073719 while reading upstream, client: 172.17.0.1, server: netdata.example2.com, request: "GET /static/js/main.98cc989e.chunk.js HTTP/2.0", upstream: "http://10.0.12.16:19999/static/js/main.98cc989e.chunk.js", host: "netdata.example2.com", referrer: "https://netdata.example2.com/" 2021/05/02 00:10:19 [warn] 6889#6889: *966650 an upstream response is buffered to a temporary file /var/tmp/nginx/proxy/0/72/0000073720 while reading upstream, client: 172.17.0.1, server: netdata.example2.com, request: "GET /static/js/2.274a88e3.chunk.js HTTP/1.1", upstream: "http://10.0.12.16:19999/static/js/2.274a88e3.chunk.js", host: "netdata.example2.com", referrer: "https://netdata.example2.com/" ``` From: `/config/log/proxy_host-63.log` ``` [01/May/2021:16:09:53 +0000] - 502 502 - GET http lab.example1.com "/" [Client 172.17.0.1] [Length 154] [Gzip -] [Sent-to 10.0.12.16] "Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.163 Mobile/15E148 Safari/604.1" "-" [02/May/2021:00:09:04 +0000] - 502 502 - GET https lab.example1.com "/" [Client 172.17.0.1] [Length 556] [Gzip -] [Sent-to 10.0.12.16] "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" "-" ``` Please let me know what you think. Thanks in advance!
kerem 2026-02-26 06:34:48 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@redtripleAAA commented on GitHub (May 2, 2021):

Update:

After I ran the following commands to do some clean up and restarted Docker host (Synology NAS)

docker image prune -a

docker network prune

It worked and now I am not longer getting the Bad Gateway error page.

<!-- gh-comment-id:830726583 --> @redtripleAAA commented on GitHub (May 2, 2021): Update: After I ran the following commands to do some clean up and restarted Docker host (Synology NAS) `docker image prune -a` `docker network prune` It worked and now I am not longer getting the Bad Gateway error page.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#884
No description provided.