Caddy use real ip behind CDN

1. Caddy version (caddy version):


2. How I run Caddy:

docker on debuan buster

a. System environment:

b. Command:

docker-compose up

d. My Caddyfile or JSON config:
reverse_proxy {
                #this is where the header stuff should go I believe.
        log {
                level DEBUG
                output file /var/log/access.log {
                        roll_size 1gb
                        roll_keep 5
                        roll_keep_for 720h

3. The problem I’m having:

Because my webserver is operating behind a CDN, I do not get the real ip for the downstream clients. I have read many wiki pages that include changing the headers, but I am not sure how to go about that. It seems related to request_header remote-addr {http.request.header.CF-Connecting-IP}.

4. Error messages and/or full log output:

5. What I already tried:

I have tried changing the headers but I am not sure if I am doing it right.

6. Links to relevant resources:

Caddy will automatically fill the X-Forwarded-For header with the IP address forwarded from your CDN.

If that’s not enough for you, please see the discussion about the realip plugin from v1, which doesn’t yet have a v2 port.


This topic was automatically closed after 30 days. New replies are no longer allowed.