jellyfin: forward client IP headers from caddy and cloudflare

This commit is contained in:
Noah Masur
2026-09-07 17:00:31 +00:00
parent ab98a202da
commit ed8be9dee6
2 changed files with 22 additions and 0 deletions
@@ -44,9 +44,27 @@ in
{
match = [ { host = [ hostnames.stream ]; } ];
handle = [
# Resolve client IP: use Cloudflare's CF-Connecting-IP if present, otherwise remote host
{
handler = "map";
source = "{http.request.header.CF-Connecting-IP}";
destinations = [ "{client_ip}" ];
defaults = [ "{http.request.remote.host}" ];
mappings = [
{
input_regexp = "^(.+)$";
outputs = [ "\${1}" ];
}
];
}
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:8096"; } ];
headers.request.set = {
"X-Real-IP" = [ "{client_ip}" ];
"X-Forwarded-For" = [ "{client_ip}" ];
"X-Forwarded-Proto" = [ "{http.request.scheme}" ];
};
}
];
}