NginxProxyManager / nginx-proxy-manager

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

IPv6 visitor real IP #4029

Open luckiestone opened 2 months ago

luckiestone commented 2 months ago

Checklist

Describe the bug

I've completed the IPv6 setup for my docker following this doc https://docs.docker.com/engine/daemon/ipv6/ , IPv6 networking itself is working. I've also added headers in NPM advanced settings:

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

The real IPv4 IP of the client is successfully forwarded, but if the client browse the site using IPv6, the real IP is IPv6 gateway of the container. The problem is solved with network mode set to "host" .

Nginx Proxy Manager Version

v2.11.3

To Reproduce Steps to reproduce the behavior: As mentioned above.

Expected behavior

Show real IPv6 of client

Screenshots

Operating System

Ubuntu

Additional context

vsatmydynipnet commented 1 month ago

I assume my problem receiving a 403 if my client has a IPv6 IP Address listed in the access list results out of the same problem. access list works for IPv4, but when running on IPv6 the Address is not whitelisted and I end up on 403 access denied.

Docker on Debian 12, running your latest image.

MangoScango commented 5 days ago

I am having the same issue, if anyone has any ideas I would appreciate it.

MangoScango commented 4 days ago

After doing more research, this is a known issue with how docker handles ipv6. I was able to resolve it by setting my /etc/docker/daemon.json to this:

{
  "ip6tables": true,
  "experimental" : true,
  "userland-proxy": true
}

I'm also on Unraid, so I updated my /config/go to the following to persist across reboots.

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &
mkdir /etc/docker
echo '{"ip6tables":true,"experimental":true,"userland-proxy":true}' > /etc/docker/daemon.json

Thanks to this project for the info: https://github.com/robbertkl/docker-ipv6nat/issues/65