-
Notifications
You must be signed in to change notification settings - Fork 51
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
There should be a way to get a peer's IP address #71
Comments
As a work-around, if you're behind a reverse proxy, you can have the proxy server add an |
There are a few ways that the client IP address can be exposed:
You have thoughts @seanmonstar? |
Probably best option, but the sad part is that it means everyone pays to store the value even though only some need access to it...
Definitely the least attractive option (why have
The reason for it not being there in the first place is because it doesn't always make sense; it's mixing HTTP with TCP/IP. Some transports have no concept of an IP address (like UDS).
I think users should probably look for that header, since in most cases, the client isn't directly connected to their server, but there's usually several steps of load balancers in the way. But I don't think a framework should be inserting this header if it didn't already exist. |
And I'd expect a framework to provide an abstraction over these (
Great point! This feels something that Go takes advantage of and makes sense. Seems like this will always have to be an |
@seanmonstar I agree with your summary. Though, a thought occurs. I wonder if additional data could be passed via the generic in Then, there would need to be an additional trait bound: |
How about doing that only when asked for, say by adding a method to the Builder like |
There should be a way to get the peer's IP address, e.g. tcpstream.peer_addr(). A peer_addr() or client_addr() method should be added to the request struct.
If this issue should be filed with hyper instead let me know.
The text was updated successfully, but these errors were encountered: