peer_addr & remote
- Dominant language
- Rust
- Stars
- 5.1k
- Forks
- 329
- PR merge metrics
- No merged PRs in 30d
Description
Actix-web makes a distinction between "peer" and "remote"
- [peer_addr](https://docs.rs/actix-web/3.0.0-alpha.1/actix_web/struct.HttpRequest.html#method.peer_addr): the address associated with the connecting host
- [remote](https://docs.rs/actix-web/3.0.0-alpha.1/actix_web/dev/struct.ConnectionInfo.html#method.remote): remote socket addr of the client that initiated the request.
The remote is resolved through the following headers, in this order:
Forwarded
X-Forwarded-For
peer name of opened socket
While the `peer_addr` always resolves to the other end of the socket. So say if a proxy forwards a request, `remote` is the browser from which the request came, while `peer_addr` would resolve to the proxy. Both need to be passed as `&str` because we want to allow unix streams to be passed as well.
This functionality would help with logging.
Contributor guide
Assessment
This issue has not been assessed yet.