mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-26 01:45:54 +03:00
[GH-ISSUE #2021] Unable to log Client IP #1462
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#1462
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 @fabienfitoussi on GitHub (Apr 21, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2021
jc21/nginx-proxy-manager:latestdocker image?Describe the bug
Hello,
I try to find a solution to my issue in the previous ticket, but any solution tested worked for me.
I installed NPM on a docker with a mariadb.
In the access log, I only trace the docker IP of the NPM container, not the real client IP
My docker compose and the nginx conf of my proxy host in attachment
docker-compose..txt
Nginx Proxy Manager Version
v2.9.18
I can access to NPM administration throught a DNS : proxy.XXXX.fr
Here the proxy_host config :
5.txt
Expected behavior
I need to log the IP of the client (like 58.245.158.25), not the 172.18.2.1 which is the gateway's subnet IP of my docker network
Operating System
I installed NPM with Portainer, on a docker hosted on a Synology NAS.
@fabienfitoussi commented on GitHub (Apr 21, 2022):
I found a fix for this issue !
In the /etc/nginx/nginx.conf, I replaced this :
real_ip_header X-Real-IP;by this
real_ip_header X-Forwarded-For;Now, I see the correct IP in the access log :
[21/Apr/2022:13:06:55 +0000] - 200 200 - GET https proxy.XXXX.fr "/api/users/me?expand=permissions" [Client 58.245.158.25] [Length 454] [Gzip -] [Sent-to 192.168.0.20] "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36" "https://proxy.XXXX.fr/nginx/proxy"To make this setting persistent, I created a nginx.conf on my host, and mount it to /etc/nginx/nginx.conf with a volume.
@Anmours commented on GitHub (May 13, 2022):
Hello, I did what you said, but it didn't achieve the expected effect. The version number is the same as you. Are you using it normally now?
@orochon commented on GitHub (Jun 22, 2022):
I've been struggling for hours on this problem, still can't resolve it.
I did the same modification as you at the nginx.conf, and I mount it with a volume.
When I go to the CLI and do a cat ont the file, I see the X-Forwarded-For.
But, even with this modification, I still only see the docker gateway in the logs :(
@Anmours commented on GitHub (Jun 22, 2022):
Like me, I didn't solve it as he said.
IP problems have plagued me for several months. Not long ago, I found a similar solution in another post. This may be a defect of Synology NAS docker. Please refer to: https://www.pedrolamas.com/2020/11/04/exposing-the-client-ips-to-docker-containers-on-synology-nas/
This is my blog based on his plan. I come from China. hope you can understand Chinese~
https://blog.amings.cn/article/382.html
:)
@lemniskett commented on GitHub (Oct 17, 2022):
Sorry for bumping, but this fixed the IP address seen from Keycloak behind NPM behind Cloudflare.
@GerritKuilder commented on GitHub (Dec 10, 2022):
I am trying to fix this too. getting the real ip address of the requests.
a) I cannot edit the nginx.con in the docker (which editor is used?)
b) I try to mount the /etc/nginx directory in a volume but that shows up blank after a restart and the proxied sites fail to work
volumes
I am mainly proxying dockers and node apps
Any advice would be appreciated.
Gerrit kuilder
@lemniskett commented on GitHub (Dec 11, 2022):
Do not mount the whole directory, just mount the nginx.conf.
@fabienfitoussi commented on GitHub (Dec 12, 2022):
Hello,
I use Portainer on Synology NAS to manage my docker containers.
Here the docker-compose i'm currently using for NPM.
I didn't mount a directory, but only the nginx.conf as you can see.
I paste you the content of my nginx.conf just below.
docker-compose :
nginx.conf