X-Forwarded-For header from Haproxy is (discarded?) by Caddy. Same setup works with Nginx

Hi Francis,

I had this in my Caddyfile before (didn’t think much of it,) which may have hidden some headers before, in my original post. (i.e. may have overridden the ‘debug’ directive?)

log {
  output file     /var/log/caddy/everything
  format          console
  level           info
}

Using the journalctl command you posted, it does show an X-Forwarded-For header of 127.0.0.1.

Now I see the X-Forwarded header is of 127.0.0.1 which is incorrect.

I would say this is a misconfiguration of my haproxy configuration, but I don’t understand why it works with Nginx of which it can resolve the correct IP (as all I’m doing is the same thing / proxy_passing incoming traffic from *:80, *:443 to 127.0.0.1:8080, 8443 therefore Nginx, like Caddy, is only seeing an incoming request from 127.0.0.1 and therefore should be functionally analogous)

Confused.

Anyway, going to sleep on this, thanks for the reply.