Caddy and Authentik are connected via docker network 172.52.0.0/24
Caddy has IP 172.52.0.100, Authentik has IP 172.52.0.10
In the Authentik App Log-File (e.g. changing something in the Admin Panel), the displayed client IP is 172.52.0.100
But it should be the IP of my computer 192.168.0.20.
With NGINX, the same installation is working via adding:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3. Caddy version:
v2.7.5
4. How I installed and ran Caddy:
Docker Container
d. My complete Caddy config:
https://sso.home.net {
reverse_proxy http://172.52.0.10:9000 {
### Things I tried but didn't work
# trusted_proxies private_ranges
# header_up X-Real-IP {remote_host}
# header_up X-Forwarded-For {remote_host}
}
tls /etc/letsencrypt/live/sso.home.net/fullchain.pem /etc/letsencrypt/live/sso.home.net/privkey.pem
}
It looks lik I have the same problem. I read everywhere that caddy is already forwarding the client IP by default, then what am I doing wrong?
I too tried header_up X-Real-IP {remote_host} and similar. What is the right configuration and/or where do I find the client IP on the backend server?
I’ve got Caddy in docker, the latest version. It is reverse proxying to a virtual machine that runs apache, wordpress and fail2ban. In what log or file could I see the original IP being forwarded? Because all I see is the IP of the reverse_proxy itself. Which is not very useful when configuring fail2ban.
I’m not using Authentik. I’m running Wordpress +LAMP behind Caddy. Sorry for asking the obvious stupid question, but how can Apache’s access.log have the IP-address of reverse proxy, but not the IP of the client, when it is supposed to get the client IP forwarded? Where would I see that client IP then?
Disabling userland-proxy did not make a difference.
See Configuration | authentik, I think you need to add Caddy’s IP address to AUTHENTIK_LISTEN__TRUSTED_PROXY_CIDRS so that it trusts X-Forwarded-* headers coming from Caddy.
Thanks! And my bigger mistake was accidentally not using a private IP range anymore with 172.52.xx.xx, for my defined docker network, so the predefined rules of Authentik didn’t work.
This is exactly what I like about caddy. It does everything that other servers do, by default. I have caddy serving as a reverse proxy for live streaming audio and video, with no extra config. It just works. Keep it up @matt and @francislavoie