pocket-id: 🐛 Bug Report: Audit log always display my Nginx Proxy Manager's IP

Reproduction steps

My Pocket-id is installed on an LXC on my Proxmox using Proxmox VE Helper Scripts

sudo bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/pocketid.sh)"

I added to my /opt/pocket-id/backend/.env

TRUST_PROXY=true
CADDY_DISABLED=true

Set up Nginx Proxy Manager to pocket-id with this Custom Nginx Configuration

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;
proxy_set_header X-Forwarded-Host $host;

However, the IPs shown in the Audit Log are always the Nginx Proxy Manager’s IP.

Image

To ensure my Nginx Proxy Manager is set up correctly, I use this Docker:

sudo docker run -d --name httpbin -p 3000:80 kennethreitz/httpbin
http://localhost:3000/headers

Setup a new host in Nginx Proxy Manager with that same Custom Nginx Configuration

curl -H "X-Forwarded-For: 192.168.1.99" https://ip-echo.xxx.xx
{
  "path": "/",
  "headers": {
    "host": "ip-echo.xxx.xx",
    "x-forwarded-scheme": "https",
    "x-forwarded-proto": "https",
    "x-forwarded-for": "192.168.1.99, 192.168.1.30",
    "x-real-ip": "192.168.1.30",
    "user-agent": "curl/8.7.1",
    "accept": "*/*"
  },
  "method": "GET",
  "body": "",
  "fresh": false,
  "hostname": "ip-echo.xxx.xx",
  "ip": "192.168.1.99",
  "ips": [
    "192.168.1.99",
    "192.168.1.30"
  ],
  "protocol": "https",
  "query": {},
  "subdomains": [
    "ip-echo"
  ],
  "xhr": false,
  "os": {
    "hostname": "16727cfaf0b3"
  },
  "connection": {}
}

From my understanding, the Nginx Proxy Manager behaves as expected.

Expected behavior

Display the IP of the client

Actual Behavior

Display the reverse proxy IP (Nginx Proxy Manager)

Version and Environment

v0.43.1

Log Output

Mar 23 18:23:43 pocketid systemd[1]: Started pocketid-backend.service - Pocket ID Backend.
Mar 23 18:23:43 pocketid pocket-id-backend[151]: 2025/03/23 18:23:43 GeoLite2 City database is up-to-date.
Mar 23 18:24:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:24:31 | 401 |      42.852µs |             ::1 | GET      "/api/users/me"
Mar 23 18:24:31 pocketid pocket-id-backend[151]: Error #01: You are not signed in
Mar 23 18:24:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:24:31 | 401 |       68.36µs |             ::1 | GET      "/api/users/me"
Mar 23 18:24:31 pocketid pocket-id-backend[151]: Error #01: You are not signed in
Mar 23 18:24:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:24:31 | 200 |     561.567µs |             ::1 | GET      "/api/application-configuration"
Mar 23 18:24:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:24:31 | 200 |      594.29µs |             ::1 | GET      "/api/application-configuration"
Mar 23 18:25:25 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:25 | 204 |     972.685µs |   192.168.1.130 | POST     "/api/webauthn/logout"
Mar 23 18:25:25 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:25 | 204 |     1.00144ms |   192.168.1.130 | POST     "/api/webauthn/logout"
Mar 23 18:25:25 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:25 | 401 |        68.7µs |             ::1 | GET      "/api/users/me"
Mar 23 18:25:25 pocketid pocket-id-backend[151]: Error #01: You are not signed in
Mar 23 18:25:25 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:25 | 401 |      96.815µs |             ::1 | GET      "/api/users/me"
Mar 23 18:25:25 pocketid pocket-id-backend[151]: Error #01: You are not signed in
Mar 23 18:25:25 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:25 | 200 |     210.698µs |             ::1 | GET      "/api/application-configuration"
Mar 23 18:25:25 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:25 | 200 |     223.225µs |             ::1 | GET      "/api/application-configuration"
Mar 23 18:25:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:31 | 200 |   17.786662ms |   192.168.1.130 | GET      "/api/webauthn/login/start"
Mar 23 18:25:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:31 | 200 |     17.9478ms |   192.168.1.130 | GET      "/api/webauthn/login/start"
Mar 23 18:25:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:31 | 401 |      73.103µs |             ::1 | GET      "/api/users/me"
Mar 23 18:25:31 pocketid pocket-id-backend[151]: Error #01: You are not signed in
Mar 23 18:25:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:31 | 401 |     135.421µs |             ::1 | GET      "/api/users/me"
Mar 23 18:25:31 pocketid pocket-id-backend[151]: Error #01: You are not signed in
Mar 23 18:25:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:31 | 200 |     303.105µs |             ::1 | GET      "/api/application-configuration"
Mar 23 18:25:31 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:31 | 200 |     323.395µs |             ::1 | GET      "/api/application-configuration"
Mar 23 18:25:41 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:41 | 200 |   26.723808ms |   192.168.1.130 | POST     "/api/webauthn/login/finish"
Mar 23 18:25:41 pocketid pocket-id-backend[151]: [GIN] 2025/03/23 - 18:25:41 | 200 |   26.750483ms |   192.168.1.130 | POST     "/api/webauthn/login/finish"
Mar 23 18:23:43 pocketid node[152]: Listening on http://0.0.0.0:3000
Mar 23 18:23:43 pocketid systemd[1]: Started pocketid-frontend.service - Pocket ID Frontend.
-- Boot 1df66e57b6374cefa0fb970bb25184b7 --
Mar 23 18:22:42 pocketid systemd[1]: pocketid-frontend.service: Consumed 1.594s CPU time.
Mar 23 18:22:42 pocketid systemd[1]: Stopped pocketid-frontend.service - Pocket ID Frontend.
Mar 23 18:22:42 pocketid systemd[1]: pocketid-frontend.service: Deactivated successfully.
Mar 23 18:22:42 pocketid systemd[1]: Stopping pocketid-frontend.service - Pocket ID Frontend...

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 28 (10 by maintainers)

Most upvoted comments

Reopening this issue, as i do belive this is a issue with pocket-id after re-reviewing things.

i think this is a restriction of proxmox ve LXC containers it doesn’t have the required kernel rights since it’s shared with the host, i think something like the ipv4 forwarding sysctl parameter should work but it would have to be on the host not the LXC container. i’m just guessing on this i haven’t tested to confirm

How should this be a limitation of LXC? All my other LXC services like immich, nextcloud, paperless, jellyfin can see the real IP of proxied requests just fine. This is 100% a pocket ID problem.

Immich doens’t even officially support anything other than docker, yet it just works out of the box there.

This issue should be fixed in v1.0.0 as Caddy has been removed from the Docker image.

I have the LXC Setup with Traefik as Reverse Proxy and it works fine for me even in a Dual Stack Environment.

I used NPM in the past and had multiple times problems with the Forwarded-For header

@yourfate @DJKatastrof Can you either of you try this image and see if its fixed? I apologize for the confusion. I do think i figured out a fix though, or at least started too: ghcr.io/kmendell/pocket-id:clientip

Hey, I’ll try this after the weekend, i’m having guests here at the moment. Thank you for looking into this!

Hi @kmendell Thanks a lot!

Is the proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; under the location / section?

Edit: Disregard i see it is. Ill see if i can figure this out.