Skip to content

reverseproxy: Fix partial response not flushed to clients#7849

Open
WeidiDeng wants to merge 3 commits into
masterfrom
fix-partial-response
Open

reverseproxy: Fix partial response not flushed to clients#7849
WeidiDeng wants to merge 3 commits into
masterfrom
fix-partial-response

Conversation

@WeidiDeng

Copy link
Copy Markdown
Member

Fix #7845 .

Assistance Disclosure

No AI is used.

Comment on lines +957 to +974
{
endpoint: "/partial",
status: 500,
bodyType: 1,
body: "partial",
},
{
endpoint: "/full",
status: 500,
bodyType: 2,
body: strings.Repeat("full", 125),
},
{
endpoint: "/empty",
status: 502,
bodyType: 2,
body: "",
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I reading this correct, partial data is sent to client albeit with code 500? Also, how come empty response gets 502 while partial content gets 500? Is this stdlib doing it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500 is the status from the backend, caddy is just forwarding the response as is unless configured otherwise.

502 is the response by default if backend doesn't reply

https://github.com/golang/go/blob/1952e618b834bda60fb9efff0fc0af46b38e110d/src/net/http/httputil/reverseproxy.go#L556

https://github.com/golang/go/blob/1952e618b834bda60fb9efff0fc0af46b38e110d/src/net/http/httputil/reverseproxy.go#L376

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.

Caddy doesn't forward truncated responses

2 participants