Allow custom responses for malformed request headers - #1004
Open
pederbe wants to merge 1 commit into
Open
Conversation
pederbe
marked this pull request as ready for review
September 10, 2026 07:36
Author
|
The nightly job failed in the existing test_backends test while checking 1.0.0.1:80, which has a one-second connection timeout. This looks like a transient network failure: the same test passed on Rust 1.97.1, and all 66 proxy tests passed on nightly. Could someone with permission please rerun the failed job? |
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.
Summary
Malformed HTTP/1 request headers receive a fixed 400 response before the normal proxy session and request context are created. Add
ProxyHttp::request_error_filterso applications can log the rejection and send their own response headers and body, or close silently.The default callback preserves the existing 400 response. Rejected connections still close, including when a custom callback returns an error, and do not enter normal request processing.
Fixes #919.
Testing
cargo test --locked -p pingora-proxy --lib: 66 passed, including 8 new tests.cargo test --locked -p pingora-proxy --doc: 1 passed; 2 existing examples ignored.cargo check --locked --workspacecargo fmt --all -- --checkcargo clippy --locked -p pingora-proxy --all-targets -- --allow=unknown-lints --deny=warningsThe new tests cover custom responses, unchanged defaults, callback errors, HEAD body suppression, pipelined input after rejection, and requests that must bypass the callback.