Skip to content

[BUG] proxy_pass not adding square brackets for ipv6 causing all ipv6 ip's to 500 error #4487

Open
@saxobroko

Description

@saxobroko

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
When putting an ipv6 address into the forward ip box (using placeholder ip), with correct configuration results in a 500 internal server error. Upon digging into it through logs and what not, it's an issue with proxy.conf. So manually removing the line include conf.d/include/proxy.conf; from proxy_host conf files and adding the following to location /

proxy_pass http://[2403:9e00:3214:af00::20]:8096;
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 $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;

Therefore based on this conclusion we can see that the default proxy_pass will allow ipv4 but will result in an error for ipv6. Additionally this temporary solution is incredibly unstable, because whenever the config is edited through NPM it reverts to the broken config.

Image

Nginx Proxy Manager Version
v2.12.3 but also got the error on v2.9.22

Expected behavior
proxy_pass should differentiate between ipv4 and ipv6 and automatically add the [ ] or the [ ] should be remobed from proxy_pass if the ip is ipv4.

Operating System
Using Docker on Windows

Additional context

Log with error:
2025/04/17 03:36:19 [error] 1617#1617: *47 invalid port in upstream "::1:8096/", client: 172.18.0.1, server: example.com, request: "GET / HTTP/2.0", host: "example.com"

the log clearly shows the url as ::1:8096 which is invalid as it should be [::1]:8096

Docker version: v4.40.0 also tested on v4.29.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions