Skip to content

Conversation

@fliespl
Copy link

@fliespl fliespl commented Sep 28, 2024

Handles cases with load balancers when caddy already verified source (i.e. cloudflare)

Resolves: #45

Handles cases with load balancers when caddy already verified source (i.e. cloudflare)
@francislavoie
Copy link
Member

I think if we make that change, it should mention that trusted_proxies should be enabled for it to actually have a useful effect.

@pothi
Copy link

pothi commented Jun 30, 2025

On Caddy server 2.10.0, both client_ip and real_ip are same if trusted_proxies isn't used. To be safe, I'd recommend keeping the configuration something like...

commonLogFormat = `{request>client_ip:request>real_ip} ` + commonLogEmptyValue + ` {user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size}`

In this way, if client_ip is not present, real_ip is used. Yet, when trusted_proxies is used, then client_ip is given the precedence in the log.

@mohammed90
Copy link
Member

In this way, if client_ip is not present, real_ip is used. Yet, when trusted_proxies is used, then client_ip is given the precedence in the log.

The format of assuming a default value isn't supported by the transform-encoder module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use client_ip instead of remote_ip in common formats?

4 participants