Repository navigation
How to preserve real client IP with rootless Podman and PublishPort?QuestionI'm running a rootless Podman setup with Traefik as a reverse proxy using Quadlets and Is there any workaround to preserve the real client IP in this setup? Environment
Setup
EvidenceTraefik access logs confirm the real IP never arrives: "ClientAddr": "10.89.0.28:60998",
"request_X-Real-Ip": "10.89.0.28"Umami is correctly configured with What has been tried
NotesI have read that this limitation may be addressed in Podman 6. Is that the case? And if so, is there any known workaround for rootless Podman on Ubuntu 26.04 LTS in the meantime? |
Replies: 4 comments 2 replies
|
On rootless bridge networks, [network]
rootless_port_forwarder = "pasta"On 5.7, run Traefik with |
|
Thank you for the answer! I'm using Podman 5.7.0 with Quadlets, so I'll go with the However, I should have mentioned this in my original question: Traefik is connected to a shared bridge network called I tried adding Network=proxy.network
Network=pastaBut Podman throws this error: So Is there a way to use pasta as the port forwarding backend for |
|
Thank you for the suggestion! I tried socket activation and it partially works — Traefik receives the real client IP correctly. However, it breaks my setup because of a hairpin NAT issue. I have PocketID running as an OIDC provider, and other services (Memos, Gitea) use it for authentication via Traefik's With Is there a way to solve this hairpin NAT issue while keeping socket activation? Or is this a fundamental limitation of this approach? |
Solution found: systemd socket activation + extra_hostsAfter a lot of research, I finally got everything working. Here is the complete solution for anyone with a similar setup (rootless Podman + Quadlets + Traefik + PocketID as OIDC provider). The two problems to solve
Solution1. Socket activation for Traefik Create two socket unit files:
[Socket]
ListenStream=80
FileDescriptorName=web
Service=traefik.service
[Install]
WantedBy=sockets.target
[Socket]
ListenStream=443
ListenDatagram=443
FileDescriptorName=websecure
Service=traefik.service
[Install]
WantedBy=sockets.targetIn [Unit]
After=network-online.target traefik-web.socket traefik-websecure.socket
Requires=traefik-web.socket traefik-websecure.socket
[Service]
Sockets=traefik-web.socket traefik-websecure.socket2. Hairpin NAT fix for services using PocketID For services running as Quadlets, add to their AddHost=auth.example.com:host-gatewayFor services running via Docker Compose (through Dockge or similar), add: extra_hosts:
- ${AUTH_FQDN}:host-gatewayWhere PocketID itself does not need any changes. ResultTraefik now receives the real client IP, analytics tools (Umami) show correct countries and IPs, and all services protected by PocketID OIDC work correctly. Thanks to everyone who pointed me in the right direction, especially the reference to podman-traefik-socket-activation. |
Solution found: systemd socket activation + extra_hosts
After a lot of research, I finally got everything working. Here is the complete solution for anyone with a similar setup (rootless Podman + Quadlets + Traefik + PocketID as OIDC provider).
The two problems to solve
Solution
1. Socket activation for Traefik
Create two socket unit files:
~/.config/systemd/user/traefik-web.socket~/…