enhancement: Forward 5XX 4XX from source to client - #2031
Open
entrop-tankos wants to merge 1 commit into
Open
Conversation
…- forward that too.
entrop-tankos
requested review from
CormickKneey,
Zephyrcf,
anjia0532,
hhhhsdxxxx,
hyy0322 and
yyzai384
September 4, 2026 22:40
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2031 +/- ##
==========================================
- Coverage 54.64% 54.44% -0.20%
==========================================
Files 101 101
Lines 27460 27570 +110
==========================================
+ Hits 15005 15010 +5
- Misses 12455 12560 +105
🚀 New features to boost your workflow:
|
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.
Description
This change improves proxy-mode error propagation by forwarding backend HTTP error responses more transparently to the client.
Previously, when a backend/origin returned a non-success HTTP status, dfdaemon could preserve the status code in some cases, but the response body was lost on the proxy path. As a result, clients only saw the status code and could not access the backend-provided error message.
With this patch, when dfdaemon is used as an HTTP proxy and the backend returns a non-success response before normal body streaming starts, dfdaemon now forwards:
This applies to proxy-mode error handling and preserves important backend-side context for callers.
Related Issue
N/A
Motivation and Context
Some origins return meaningful error details in the response body together with 4xx/5xx statuses. Typical examples include:
That information is important for clients building their own retry and backoff logic on top of Dragonfly.
Without the response body, the caller only sees a generic HTTP error code and loses the backend-specific reason, which makes it much harder to distinguish between retryable and non-retryable failures.
This patch fixes that behavior by preserving and forwarding the backend error body to the client when available.