New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for peerAddress on Request #2736
Labels
Projects
Comments
@VineFiner , Vapor/HTTP is only used in Vapor 3. My issue targets regression in Vapor 4. |
paunik
pushed a commit
to paunik/vapor
that referenced
this issue
May 11, 2022
MR for vapor#2736 - Added computed property peerAddress on Request class that parses headers commonly used by proxies and load ballancers to pass through originating client address - Added tests for peerAddress computed property
paunik
pushed a commit
to paunik/vapor
that referenced
this issue
May 11, 2022
MR for vapor#2736 - Added computed property peerAddress on Request class that parses headers commonly used by proxies and load balancers to pass through originating client address - Added tests for peerAddress computed property
Hello @Joannis, I tried to do this for the Vapor 4. |
@paunik I'll continue the discussion in your PR |
paunik
pushed a commit
to paunik/vapor
that referenced
this issue
May 24, 2022
MR for vapor#2736 - Added computed property peerAddress on Request class that parses headers commonly used by proxies and load balancers to pass through originating client address - Added tests for peerAddress computed property
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When checking a request's
remoteAddress
, it's usually the address from which NIO received the request. While that's technically correct, Vapor servers are often hosted behind a reverse-proxy such as nginx. Therefore the original peer's address is often lost. To resolve this, it's not uncommon to set the original peer's address in a header such asX-Forwarded-For
.Describe the solution you'd like
I'd like Vapor to add a property on Request, such as
peerAddress
, which reads the headers to find the peer's address first.The text was updated successfully, but these errors were encountered: