Skip to content

Conversation

@zefr0x
Copy link

@zefr0x zefr0x commented Aug 31, 2025

realip_remote_addr can be spoofed without using proxy or not configuring it properly. peer_addr is considered more trustworthy for security-sensitive operations, which is the actual socket address of the client when not behind any proxy, and the proxy's address otherwise.

When we are using a trusted and properly configured proxy, peer_addr should return the proxy's address, and realip_remote_addr should return a trusted client address.

Read:
https://docs.rs/actix-web/4.11.0/actix_web/dev/struct.ConnectionInfo.html#security

`realip_remote_addr` can be spoofed without using proxy or not
configuring it properly. `peer_addr` is considered more trustworthy for
security-sensitive operations, which is the actual socket address of the
client when not behind any proxy, and the proxy's address otherwise.

When we are using a trusted and properly configured proxy, `peer_addr`
should return the proxy's address, and `realip_remote_addr` should return
a trusted client address.
@omid
Copy link
Contributor

omid commented Sep 10, 2025

@zefr0x read this: #106 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants