add support for proxy headers#744
Conversation
|
If this is just for logging I might suggest this happens in groob/finalizer. Reason being that because we're using structured logs we can just as well log both the remote addr and the rproxy headers together. No need to lose the actual remote ip (say, in the case you have multiple proxies). But I dunno, I could see it both ways. Thoughts? |
|
The middleware only modifies the I suppose you could copy the relevant code behind the handler to I don't really care either way. You and @groob just let me know what you'd like to see, and I can do a PR to groob/finalizer if need be. |
|
@korylprince looks like we have conflicts. tidy those up and we'll get this merged. i may open a tracking issue for future consideration of adding this to finalizer |
|
@jessepeterson I got this rebased to micromdm:main. Thanks! |
Right now, if you run micromdm behind a reverse proxy, logs always show the same request host (the proxy itself). This adds a middleware that parses X-Forwarded-For, X-Real-IP, etc headers that reverse proxies set so the downstream handlers (i.e. loggers) see the real client IP.
This is hidden behind a default-off flag, as you don't want to parse these headers unless you're behind a trusted proxy.