Skip to content

How to get the right client side IP address in logs while the planka runs behind a caddy2? #645

Closed Answered by meltyshev
peace4j asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! I'm not very familiar with this, but you could try setting the environment variable TRUST_PROXY=1. I've checked in the code that when it's set, it should use the IP address from X-Forwarded-For:

// Assert if "X-Forwarded-For" header contains any addresses
if (process.env.TRUST_PROXY && !_.isEmpty(request.ips)) {
  // eslint-disable-next-line prefer-destructuring
  remoteAddress = request.ips[0];
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@peace4j
Comment options

Answer selected by peace4j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants