I want to pass the actual IP address of the client accessing the web server through a reverse proxy. For example, I have software running at 192.168.2.3, and I am trying to access it from 10.1.10.21. The web server is seeing the IP of the Caddy server (10.1.10.252) instead of 10.1.10.21.
2. Error messages and/or full log output:
N/A
3. Caddy version:
2.8.4 h1
4. How I installed and ran Caddy:
Fresh install of Ubuntu 24.04. Caddy installed using apt.
a. System environment:
Ubuntu 24.04 on AMD64 CPU
b. Command:
I feel like I have googled and tried so many things, but none seem to work, or in some cases, the caddy service won’t start.
c. Service/unit/compose file:
N/A
d. My complete Caddy config:
{
email swittwer@xxxxxxxxxxxxl.com
}
#log file procedure
(logging) {
log {
output file /var/log/caddy/{args[0]}.log {
roll_size 5MiB # Set max size 5 MB
roll_keep 2 # Keep at most 2 log files
roll_keep_for 96h # Keep log files for 4 days
}
}
}
catalina.xxxxxxxxxxxx.com {
import logging catalina
reverse_proxy 192.168.2.3:443 {
transport http {
tls
tls_insecure_skip_verify
}
}
}
Your software running at 192.168.2.3 already has access to this information as Caddy sets this header without you having to configure anything. You might have to consult the documentation for your software to determine whether and how it can properly use it.
Not likely to be relevant. Your upstream software may specifically require it - check said software’s documentation - otherwise, it’s a waste of bytes.
Probably not relevant either - once again, unless your upstream software specifically needs it. The vast vast majority will not, making this another waste of bytes in most cases.
transport http {
versions 2
keepalive 65s
}
Not relevant to the topic of passing the client IP.