PROXY protocol support - #17
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds optional PROXY protocol (v1/v2) support to the core listener stack, allowing Rocket to recover the original client address from a TCP-level preamble when running behind L4 proxies/load balancers (e.g., HAProxy TCP mode, AWS NLB), and documents/configures the feature across the project.
Changes:
- Introduces a new
ProxyProtocolListener(behind theproxy-protocrate feature) and wires it intoDefaultListener(including TLS composition). - Adds a new
proxy_protocolconfiguration key (envROCKET_PROXY_PROTOCOL) plus user-facing docs and changelog entries. - Adds testbench coverage and enables the feature in CI/test scripts.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/11-deploying.md | Documents when/how to use PROXY protocol for client address recovery behind L4 proxies. |
| website/docs/10-configuration.md | Adds proxy_protocol config option and a new “PROXY Protocol” configuration section. |
| testbench/src/servers/sni_resolver.rs | Import reordering (no functional change). |
| testbench/src/servers/proxy_proto.rs | Adds integration tests validating forwarded remote address + rejection behavior. |
| testbench/src/servers/mod.rs | Registers the new proxy_proto test server module. |
| testbench/Cargo.toml | Enables rkt’s proxy-proto feature for testbench builds. |
| scripts/test.sh | Adds proxy-proto to the feature matrix exercised by tests. |
| core/lib/src/tls/listener.rs | Adjusts TlsListener’s Accept/connect plumbing to compose with additional listener layers. |
| core/lib/src/listener/proxy.rs | Implements PROXY protocol v1/v2 parsing + listener/stream wrapper (new). |
| core/lib/src/listener/mod.rs | Exposes the new listener::proxy module behind the proxy-proto feature. |
| core/lib/src/listener/default.rs | Wraps transport listeners with ProxyProtocolListener when compiled + adds config/error wiring. |
| core/lib/src/lib.rs | Documents the new proxy-proto crate feature. |
| core/lib/Cargo.toml | Declares the new proxy-proto feature flag. |
| CHANGELOG.md | Adds an Unreleased entry describing PROXY protocol support and configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AI-Tool: Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
More detail to follow.
Based on rwf2/Rocket#2997