Skip to content

fix: cannot rewind body after connection loss error#65873

Open
alexivanoff wants to merge 1 commit into
gravitational:branch/v17from
alexivanoff:fix/buffer-http-body-v17
Open

fix: cannot rewind body after connection loss error#65873
alexivanoff wants to merge 1 commit into
gravitational:branch/v17from
alexivanoff:fix/buffer-http-body-v17

Conversation

@alexivanoff
Copy link
Copy Markdown

A fix to prevent "net/http: cannot rewind body after connection loss" errors for #65611

@github-actions
Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b8770a477

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


// Buffering req.Body so that HTTP/2 transport can retry
if req.Body != nil && req.Body != http.NoBody {
bodyBytes, err := io.ReadAll(req.Body)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid buffering entire request body in catchAll

catchAll is the fallback path for non-special Kubernetes routes, and this new io.ReadAll(req.Body) forces full in-memory buffering before forwarding instead of streaming. For large or streaming request bodies (for example, proxied aggregated API/service endpoints), this can significantly increase latency and memory usage, and allows a single authenticated large upload to consume substantial heap on the proxy. This should be bounded or gated so retries don’t require unbounded buffering for every request body.

Useful? React with 👍 / 👎.

@jakealti
Copy link
Copy Markdown
Contributor

Thanks for the hotfix. The actual fix landed in #66605 (merged 2026-05-11), which closes #65611. You can close this PR.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants