drogon icon indicating copy to clipboard operation
drogon copied to clipboard

Support retreving IP information from `X-Forwarded-For` header

Open marty1885 opened this issue 4 years ago • 1 comments

As of now, when drogon is running behind a reverse proxy, drogon can only see the reverse proxy's IP as the peer IP. Which is technically true. But not what we want. Causing AccessLogger logging the IP of the proxy, etc... This PR adds an option trustProxy to listeners (name taken from express.js). When set, it uses the information in X-Forwarded-For header for the peer IP.

marty1885 avatar Aug 31 '21 08:08 marty1885

I have a little doubt if we should overwrite peerAddr_. I think user would expect that getPeerAddr() returns the same thing as ::getpeername() does? At least I'm expecting that.

hwc0919 avatar Sep 01 '21 10:09 hwc0919

Resolved by RealIpResolver #1321

hwc0919 avatar May 11 '23 03:05 hwc0919