[GH-ISSUE #1334] Bad Gateway Error #1063

Closed
opened 2026-02-26 06:35:37 +03:00 by kerem · 6 comments
Owner

Originally created by @Seralius on GitHub (Aug 19, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1334

Used Docker Stack
The Used Docker-Stack was the Docker-Compose from the Website at https://nginxproxymanager.com/guide/#quick-setup

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
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug

I'm getting an Bad Gateway Error when trying to setup an Proxy-Host for External Websites (specifically when using HTTPS)

Nginx Proxy Manager Version

v2.2.3

To Reproduce
Steps to reproduce the behavior:

  1. See Pictures at Screenshots

Expected behavior

I can successfully reverse-proxy the given Website

Screenshots

Here is an Example where i tried to setup an Proxy-Host for https://nginxproxymanager.com:443:
image
image
image
To test if the Container can access the Website, i did an Curl of the Exact URL inside of the Container, which is successful:
image

Operating System

Debian Server

Additional Information

Originally created by @Seralius on GitHub (Aug 19, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1334 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Used Docker Stack** The Used Docker-Stack was the Docker-Compose from the Website at [https://nginxproxymanager.com/guide/#quick-setup](url) **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 - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** <!-- A clear and concise description of what the bug is. --> I'm getting an Bad Gateway Error when trying to setup an Proxy-Host for External Websites (specifically when using HTTPS) **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> v2.2.3 **To Reproduce** Steps to reproduce the behavior: 1. See Pictures at Screenshots **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> I can successfully reverse-proxy the given Website **Screenshots** <!-- If applicable, add screenshots to help explain your problem. --> Here is an Example where i tried to setup an Proxy-Host for https://nginxproxymanager.com:443: ![image](https://user-images.githubusercontent.com/26837295/130075227-d6c27f16-481e-43ba-bf4b-e20db1664b89.png) ![image](https://user-images.githubusercontent.com/26837295/130075498-bddc0d27-a89a-4db8-9068-c85923bbddde.png) ![image](https://user-images.githubusercontent.com/26837295/130075680-d54225d8-81f1-44eb-a294-8247660cb0e0.png) To test if the Container can access the Website, i did an Curl of the Exact URL inside of the Container, which is successful: ![image](https://user-images.githubusercontent.com/26837295/130076403-5f606d83-35a1-432e-b229-af1230a73b89.png) **Operating System** <!-- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error. --> Debian Server **Additional Information**
kerem 2026-02-26 06:35:37 +03:00
  • closed this issue
  • added the
    stale
    bug
    labels
Author
Owner

@jc21 commented on GitHub (Aug 19, 2021):

This is an interesting problem. I haven't really tried forwarding to hosts outside of my own network, until now.

I inspected the nginx logs for the proxy host, and it looks like this is a Nginx problem not one to do with the configuration of this host.

2021/08/19 22:56:13 [crit] 90998#90998: *27749 connect() to [2600:9000:20ec:1800:2:8434:1380:93a1]:443 failed (99: Cannot assign requested address) while connecting to upstream, client: 192.168.0.38, server: example.jc21.supernerd.pro, request: "GET /favicon.ico HTTP/1.1", upstream: "https://[2600:9000:20ec:1800:2:8434:1380:93a1]:443/favicon.ico", host: "example.jc21.supernerd.pro", referrer: "http://example.jc21.supernerd.pro/"

2021/08/19 22:56:13 [warn] 90998#90998: *27749 upstream server temporarily disabled while connecting to upstream, client: 192.168.0.38, server: example.jc21.supernerd.pro, request: "GET /favicon.ico HTTP/1.1", upstream: "https://[2600:9000:20ec:1800:2:8434:1380:93a1]:443/favicon.ico", host: "example.jc21.supernerd.pro", referrer: "http://example.jc21.supernerd.pro/"

so it appears that nginx is trying to access the host on the ipv6 address directly instead of a hostname? 🤷

The proxy host config is essentially this:

server {
  set $forward_scheme https;
  set $server         "nginxproxymanager.com";
  set $port           443;

  listen 80;
  listen [::]:80;

  server_name example.jc21.supernerd.pro;

  access_log /data/logs/proxy-host-121_access.log proxy;
  error_log /data/logs/proxy-host-121_error.log warn;

  location / {
    add_header       X-Served-By $host;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_set_header X-Real-IP          $remote_addr;
    proxy_pass       $forward_scheme://$server:$port;
  }
}

and I don't see any problems with the configuration.

I found this problem related to the error, and tried to apply the solution but has not worked for me.

<!-- gh-comment-id:902312321 --> @jc21 commented on GitHub (Aug 19, 2021): This is an interesting problem. I haven't really tried forwarding to hosts outside of my own network, until now. I inspected the nginx logs for the proxy host, and it looks like this is a Nginx problem not one to do with the configuration of this host. ``` 2021/08/19 22:56:13 [crit] 90998#90998: *27749 connect() to [2600:9000:20ec:1800:2:8434:1380:93a1]:443 failed (99: Cannot assign requested address) while connecting to upstream, client: 192.168.0.38, server: example.jc21.supernerd.pro, request: "GET /favicon.ico HTTP/1.1", upstream: "https://[2600:9000:20ec:1800:2:8434:1380:93a1]:443/favicon.ico", host: "example.jc21.supernerd.pro", referrer: "http://example.jc21.supernerd.pro/" 2021/08/19 22:56:13 [warn] 90998#90998: *27749 upstream server temporarily disabled while connecting to upstream, client: 192.168.0.38, server: example.jc21.supernerd.pro, request: "GET /favicon.ico HTTP/1.1", upstream: "https://[2600:9000:20ec:1800:2:8434:1380:93a1]:443/favicon.ico", host: "example.jc21.supernerd.pro", referrer: "http://example.jc21.supernerd.pro/" ``` so it appears that nginx is trying to access the host on the ipv6 address directly instead of a hostname? 🤷 The proxy host config is essentially this: ``` server { set $forward_scheme https; set $server "nginxproxymanager.com"; set $port 443; listen 80; listen [::]:80; server_name example.jc21.supernerd.pro; access_log /data/logs/proxy-host-121_access.log proxy; error_log /data/logs/proxy-host-121_error.log warn; location / { add_header X-Served-By $host; proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_pass $forward_scheme://$server:$port; } } ``` and I don't see any problems with the configuration. I found [this problem](https://stackoverflow.com/questions/3191509/nginx-error-99-cannot-assign-requested-address) related to the error, and tried to apply the solution but has not worked for me.
Author
Owner

@jc21 commented on GitHub (Aug 19, 2021):

I just tried a different upstream host that does not have an ipv6 address and I don't get any errors in the logs, but the upstream server is returning 501 not implemented so it's probably the upstream server not happy with the proxied request.

<!-- gh-comment-id:902313728 --> @jc21 commented on GitHub (Aug 19, 2021): I just tried a different upstream host that does not have an ipv6 address and I don't get any errors in the logs, but the upstream server is returning 501 not implemented so it's probably the upstream server not happy with the proxied request.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 6, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:1979932425 --> @github-actions[bot] commented on GitHub (Mar 6, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@harryyang2024 commented on GitHub (May 24, 2024):

I got same error : [ipv6 address]:443 failed (99: Cannot assign requested address), when the target host that only have a public ipv6 address.
So I wonder if the container don't support ipv6.
After I add option network_mode: host in docker compose file, I didn't get the error.
Hope it will be helpful!

<!-- gh-comment-id:2128482090 --> @harryyang2024 commented on GitHub (May 24, 2024): I got same error : **[ipv6 address]:443 failed (99: Cannot assign requested address)**, when the target host that only have a public ipv6 address. So I wonder if the container don't support ipv6. After I add option **network_mode: host** in docker compose file, I didn't get the error. Hope it will be helpful!
Author
Owner

@github-actions[bot] commented on GitHub (Feb 7, 2025):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2641751707 --> @github-actions[bot] commented on GitHub (Feb 7, 2025): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Feb 22, 2026):

Issue was closed due to inactivity.

<!-- gh-comment-id:3939942790 --> @github-actions[bot] commented on GitHub (Feb 22, 2026): Issue was closed due to inactivity.
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#1063
No description provided.