mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-26 01:45:54 +03:00
[GH-ISSUE #2933] NPM logs are showing docker IP instead of client IP #2007
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#2007
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @silmarine on GitHub (May 19, 2023).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2933
Checklist
jc21/nginx-proxy-manager:latestdocker image?Describe the bug
In the proxy host logs it shows client information and everything is detected correctly except the client IP, which it shows a docker IP that is on the server where NPM is running on. Following is an example of what I have in my logs with sensitive info redacted.
[19/May/2023:12:44:44 +0000] - - 401 - GET http redacted-url "/" [Client 172.18.0.1] [Length 176] [Gzip -] [Sent-to 192.168.1.10] "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0" "-"I've seen a few issues here that describe something similar and suggest changing the nginx.conf file and replace
real_ip_header X-Real-IP;withreal_ip_header X-Forwarded-For;. I tried that but it didn't work. I'm trying to get fail2ban to work and it depends on these logs having the correct IP, otherwise it will just ban the host docker IP.Nginx Proxy Manager Version
v2.10.3
Expected behavior
That the log shows next to client not the docker IP but the actual client IP, such as:
[19/May/2023:12:44:44 +0000] - - 401 - GET http redacted-url "/" [Client 192.168.1.200] [Length 176] [Gzip -] [Sent-to redacted-ip] "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0" "-"Operating System
NPM is running on a Debian VM in Proxmox.
@silmarine commented on GitHub (May 22, 2023):
I found this comment in a bug for nginx: https://github.com/nginx-proxy/nginx-proxy/issues/133#issuecomment-1368745843 and it seems that is my issue.
In summary for anyone stumbling onto this: I have IPv6 active in my network and this server where NPM is running has an IPv6 address. Docker by default doesn't used IPv6 so any incoming connections from IPv6 clients has to be translated to IPv4, therefore it comes from the docker gateway. I change my DNS entry for one of the domains NPM is proxying to only have IPv4 so my clients would access it through IPv4 only and with that the logs are correct. So the solution is to either follow the instructions in the linked comment above to activate IPv6 in docker or just have only IPv4 DNS entries.
@medram commented on GitHub (Feb 11, 2025):
Hello everyone, I run into the same issue, and I solved it like this:
My config file
./configs/server_proxy.conf:Note: You can change
CF-Connecting-IPwith anything you want if needed.