NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
23.27k stars 2.7k forks source link

ERRO 502 Bad Gateway on reverse proxy with public IPV6. #4173

Open RafaelMachadok2xt opened 3 days ago

RafaelMachadok2xt commented 3 days ago

I set up a server with Ubuntu Server 24.04 LTS on an old PC, everything configured with IPv6. It’s all working when I access the application (portainer, grafana, Nginx Proxy Manager . . .) externally via IPv6 and its corresponding port. However, when I set up reverse proxy using Nginx proxy Manager, I get a 502 Bad Gateway error.

When I type the IPv6 address of the instance in the browser, the Nginx welcome page appears, indicating that Nginx itself is working fine. The issue seems to be related to some network configuration.

Does anyone have any idea what could be causing this?

Note: All necessary ports for the applications are open in UFW, both for inbound and outbound traffic. The applications work externally with IPv6 and their respective ports. The problem only occurs when using domains with reverse proxy.

Nginx Proxy Manager Version 2.11.1

docker and portainer latesst version

To Reproduce Steps to reproduce the behavior:

  1. Go to portainer.k2xttechnology.com.br

    See error 502 bad gateway Nginx proxy manager erro

Expected behavior Proxy reverse working on IPV6

Logs from portainer

Group: npm PGID:0 ID:0

❯ Starting nginx ... ❯ Starting backend ... [11/18/2024] [2:13:37 PM] [Global ] › ℹ info Using Sqlite: /data/database.sqlite [11/18/2024] [2:13:37 PM] [Migrate ] › ℹ info Current database version: none [11/18/2024] [2:13:37 PM] [Setup ] › ℹ info Logrotate Timer initialized [11/18/2024] [2:13:37 PM] [Global ] › ⬤ debug CMD: logrotate /etc/logrotate.d/nginx-proxy-manager [11/18/2024] [2:13:38 PM] [Setup ] › ℹ info Logrotate completed. [11/18/2024] [2:13:38 PM] [IP Ranges] › ℹ info Fetching IP Ranges from online services... [11/18/2024] [2:13:38 PM] [IP Ranges] › ℹ info Fetching https://ip-ranges.amazonaws.com/ip-ranges.json [11/18/2024] [2:13:38 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v4 [11/18/2024] [2:13:38 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v6 [11/18/2024] [2:13:38 PM] [SSL ] › ℹ info Let's Encrypt Renewal Timer initialized [11/18/2024] [2:13:38 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ... [11/18/2024] [2:13:38 PM] [IP Ranges] › ℹ info IP Ranges Renewal Timer initialized [11/18/2024] [2:13:38 PM] [Global ] › ℹ info Backend PID 153 listening on port 3000 ... [11/18/2024] [2:13:38 PM] [SSL ] › ℹ info Completed SSL cert renew process [11/18/2024] [2:15:02 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [2:15:02 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/proxy_host/3.conf [11/18/2024] [2:15:02 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [2:15:02 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [2:15:02 PM] [Nginx ] › ℹ info Reloading Nginx [11/18/2024] [2:15:02 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -s reload [11/18/2024] [2:26:34 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [2:26:34 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/proxy_host/3.conf [11/18/2024] [2:26:34 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [2:26:34 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [2:26:34 PM] [Nginx ] › ℹ info Reloading Nginx [11/18/2024] [2:26:34 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -s reload [11/18/2024] [3:13:38 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ... [11/18/2024] [3:13:38 PM] [SSL ] › ℹ info Completed SSL cert renew process [11/18/2024] [3:40:31 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/proxy_host/5.conf [11/18/2024] [3:40:31 PM] [Nginx ] › ⬤ debug Could not delete file: { "errno": -2, "code": "ENOENT", "syscall": "unlink", "path": "/data/nginx/proxy_host/5.conf" } [11/18/2024] [3:40:31 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/proxy_host/5.conf.err [11/18/2024] [3:40:31 PM] [Nginx ] › ⬤ debug Could not delete file: { "errno": -2, "code": "ENOENT", "syscall": "unlink", "path": "/data/nginx/proxy_host/5.conf.err" } [11/18/2024] [3:40:31 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [3:40:31 PM] [Nginx ] › ℹ info Reloading Nginx [11/18/2024] [3:40:31 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -s reload [11/18/2024] [3:40:36 PM] [SSL ] › ℹ info Requesting Let'sEncrypt certificates for Cert #8: npm.k2xttechnology.com.br [11/18/2024] [3:40:36 PM] [SSL ] › ℹ info Command: certbot certonly --config "/etc/letsencrypt.ini" --work-dir "/tmp/letsencrypt-lib" --logs-dir "/tmp/letsencrypt-log" --cert-name "npm-8" --agree-tos --authenticator webroot --email "rafael@k2xttechnology.com.br" --preferred-challenges "dns,http" --domains "npm.k2xttechnology.com.br" [11/18/2024] [3:40:36 PM] [Global ] › ⬤ debug CMD: certbot certonly --config "/etc/letsencrypt.ini" --work-dir "/tmp/letsencrypt-lib" --logs-dir "/tmp/letsencrypt-log" --cert-name "npm-8" --agree-tos --authenticator webroot --email "rafael@k2xttechnology.com.br" --preferred-challenges "dns,http" --domains "npm.k2xttechnology.com.br" [11/18/2024] [3:40:39 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/temp/letsencrypt_8.conf [11/18/2024] [3:40:39 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [3:40:39 PM] [Nginx ] › ℹ info Reloading Nginx [11/18/2024] [3:40:39 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -s reload [11/18/2024] [3:40:40 PM] [Express ] › ⚠ warning Saving debug log to /tmp/letsencrypt-log/letsencrypt.log Some challenges have failed. Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/letsencrypt-log/letsencrypt.log or re-run Certbot with -v for more details. [11/18/2024] [3:42:36 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/proxy_host/5.conf [11/18/2024] [3:42:36 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/proxy_host/5.conf.err [11/18/2024] [3:42:36 PM] [Nginx ] › ⬤ debug Could not delete file: { "errno": -2, "code": "ENOENT", "syscall": "unlink", "path": "/data/nginx/proxy_host/5.conf.err" } [11/18/2024] [3:42:36 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [3:42:36 PM] [Nginx ] › ℹ info Reloading Nginx [11/18/2024] [3:42:36 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -s reload [11/18/2024] [3:42:41 PM] [SSL ] › ℹ info Requesting Let'sEncrypt certificates for Cert #9: npm.k2xttechnology.com.br [11/18/2024] [3:42:41 PM] [SSL ] › ℹ info Command: certbot certonly --config "/etc/letsencrypt.ini" --work-dir "/tmp/letsencrypt-lib" --logs-dir "/tmp/letsencrypt-log" --cert-name "npm-9" --agree-tos --authenticator webroot --email "rafael@k2xttechnology.com.br" --preferred-challenges "dns,http" --domains "npm.k2xttechnology.com.br" [11/18/2024] [3:42:41 PM] [Global ] › ⬤ debug CMD: certbot certonly --config "/etc/letsencrypt.ini" --work-dir "/tmp/letsencrypt-lib" --logs-dir "/tmp/letsencrypt-log" --cert-name "npm-9" --agree-tos --authenticator webroot --email "rafael@k2xttechnology.com.br" --preferred-challenges "dns,http" --domains "npm.k2xttechnology.com.br" [11/18/2024] [3:42:43 PM] [Nginx ] › ⬤ debug Deleting file: /data/nginx/temp/letsencrypt_9.conf [11/18/2024] [3:42:43 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [3:42:44 PM] [Nginx ] › ℹ info Reloading Nginx [11/18/2024] [3:42:44 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -s reload [11/18/2024] [3:42:44 PM] [Express ] › ⚠ warning Saving debug log to /tmp/letsencrypt-log/letsencrypt.log Some challenges have failed. Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/letsencrypt-log/letsencrypt.log or re-run Certbot with -v for more details. [11/18/2024] [4:13:38 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ... [11/18/2024] [4:13:38 PM] [SSL ] › ℹ info Completed SSL cert renew process [11/18/2024] [5:13:38 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ... [11/18/2024] [5:13:38 PM] [SSL ] › ℹ info Completed SSL cert renew process [11/18/2024] [6:13:38 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ... [11/18/2024] [6:13:38 PM] [SSL ] › ℹ info Completed SSL cert renew process [11/18/2024] [7:13:38 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ... [11/18/2024] [7:13:38 PM] [SSL ] › ℹ info Completed SSL cert renew process [11/18/2024] [8:13:38 PM] [IP Ranges] › ℹ info Fetching IP Ranges from online services... [11/18/2024] [8:13:38 PM] [IP Ranges] › ℹ info Fetching https://ip-ranges.amazonaws.com/ip-ranges.json [11/18/2024] [8:13:38 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ... [11/18/2024] [8:13:38 PM] [SSL ] › ℹ info Completed SSL cert renew process [11/18/2024] [8:13:38 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v4 [11/18/2024] [8:13:38 PM] [IP Ranges] › ℹ info Fetching https://www.cloudflare.com/ips-v6 [11/18/2024] [8:13:38 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -t -g "error_log off;" [11/18/2024] [8:13:38 PM] [Nginx ] › ℹ info Reloading Nginx [11/18/2024] [8:13:38 PM] [Global ] › ⬤ debug CMD: /usr/sbin/nginx -s reload

Mainfrezzer commented 2 days ago

May i ask why youre trying to connect to port 9000 of portainer via https? Thats the http port, https is 9443

lastsamurai26 commented 2 days ago

And what i see is that between https:// and the ip is a space image

RafaelMachadok2xt commented 2 days ago

May i ask why youre trying to connect to port 9000 of portainer via https? Thats the http port, https is 9443

It doesn't work on both ports .

RafaelMachadok2xt commented 2 days ago

And what i see is that between https:// and the ip is a space image

There isn't space between https:// and the ip

Mainfrezzer commented 2 days ago

May i ask why youre trying to connect to port 9000 of portainer via https? Thats the http port, https is 9443

It doesn't work on both ports .

Is your portainer also exposed on the host with those ports?

Portainer Nginx Portainer-Public

lastsamurai26 commented 2 days ago

And what i see is that between https:// and the ip is a space image

There isn't space between https:// and the ip

ok then compare this one with yours

image ;-) then you will see it