[GH-ISSUE #2933] NPM logs are showing docker IP instead of client IP #2007

Closed
opened 2026-02-26 07:33:40 +03:00 by kerem · 2 comments
Owner

Originally created by @silmarine on GitHub (May 19, 2023).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2933

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes (as of writing latest is v2.10.3)
  • 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
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; with real_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.

Originally created by @silmarine on GitHub (May 19, 2023). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2933 **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes (as of writing latest is v2.10.3) - 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** 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;` with `real_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.
kerem 2026-02-26 07:33:40 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@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.

<!-- gh-comment-id:1556835704 --> @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.
Author
Owner

@medram commented on GitHub (Feb 11, 2025):

Hello everyone, I run into the same issue, and I solved it like this:

npm:
    image: jc21/nginx-proxy-manager:2.12.1
    ports:
      - "80:80"
      - "443:443"
      - "8090:81"
    environment:
     ...
    volumes:
      - ${NFS_DOCKER_VOLUMES}/npm_volume/data:/data
      - ${NFS_DOCKER_VOLUMES}/npm_volume/letsencrypt:/etc/letsencrypt
      # Fixed by mounting it to this path.       
      - ./configs/server_proxy.conf:/data/nginx/custom/server_proxy.conf

My config file ./configs/server_proxy.conf:

# Required to pass the real client IP address to the backend services 
real_ip_header CF-Connecting-IP;

Note: You can change CF-Connecting-IP with anything you want if needed.

<!-- gh-comment-id:2651996408 --> @medram commented on GitHub (Feb 11, 2025): Hello everyone, I run into the same issue, and I solved it like this: ```yml npm: image: jc21/nginx-proxy-manager:2.12.1 ports: - "80:80" - "443:443" - "8090:81" environment: ... volumes: - ${NFS_DOCKER_VOLUMES}/npm_volume/data:/data - ${NFS_DOCKER_VOLUMES}/npm_volume/letsencrypt:/etc/letsencrypt # Fixed by mounting it to this path. - ./configs/server_proxy.conf:/data/nginx/custom/server_proxy.conf ``` My config file `./configs/server_proxy.conf`: ```txt # Required to pass the real client IP address to the backend services real_ip_header CF-Connecting-IP; ``` Note: You can change `CF-Connecting-IP` with anything you want if needed.
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#2007
No description provided.