http-rs / http-rs/tide

peer_addr & remote

Open
#462 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.