WeidiDeng / caddy-cloudflare-ip

Apache License 2.0
50 stars 2 forks source link

invalid IP address: 'cloudflare': ParseAddr("cloudflare"): unable to parse IP #7

Closed cellulosa closed 6 months ago

cellulosa commented 6 months ago

heya, I'm building this with:

FROM caddy:builder AS builder

RUN xcaddy build \
    --with github.com/WeidiDeng/caddy-cloudflare-ip

FROM caddy:latest

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

But am getting this error when launching:

invalid IP address: 'cloudflare': ParseAddr("cloudflare"): unable to parse IP

Thsi is my Caddifile

{
    servers {
        trusted_proxies static 192.168.0.10 cloudflare {
            interval 12h
            timeout 15s
        }
    }
}
mrrfv commented 6 months ago

Try putting cloudflare before static (or even repeating the trusted_proxies option for both modules if that doesn't work). cloudflare in your current Caddyfile is parsed as an IP address, according to the Caddy documentation: https://caddyserver.com/docs/caddyfile/options#trusted-proxies

francislavoie commented 6 months ago

To merge two lists of IPs (cloudflare + static), you should use https://github.com/fvbommel/caddy-combine-ip-ranges which can take more than one IP source plugin.

cellulosa commented 6 months ago

lovely, thank you!