Skip to content

[26.0] Strip content-length and accept-ranges headers from proxied streaming responses#22314

Merged
dannon merged 1 commit intogalaxyproject:release_26.0from
mvdbeek:fix-proxy-streaming-headers
Apr 2, 2026
Merged

[26.0] Strip content-length and accept-ranges headers from proxied streaming responses#22314
dannon merged 1 commit intogalaxyproject:release_26.0from
mvdbeek:fix-proxy-streaming-headers

Conversation

@mvdbeek
Copy link
Copy Markdown
Member

@mvdbeek mvdbeek commented Mar 31, 2026

The proxy endpoint can truncate responses via MAX_STREAM_BYTES or MAX_STREAM_SECONDS limits. When content-length from the upstream was forwarded but the stream was cut short, uvicorn raised "LocalProtocolError: Too little data for declared Content-Length".

Fix by always excluding content-length from forwarded headers. The StreamingResponse uses chunked transfer encoding instead, which tolerates early stream termination. Also strip accept-ranges since without content-length clients can't issue range requests anyway. HEAD responses still forward both headers unfiltered.

Fixes #22313

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

… responses

The proxy endpoint can truncate responses via MAX_STREAM_BYTES or
MAX_STREAM_SECONDS limits. When content-length from the upstream was
forwarded but the stream was cut short, uvicorn raised
"LocalProtocolError: Too little data for declared Content-Length".

Fix by always excluding content-length from forwarded headers. The
StreamingResponse uses chunked transfer encoding instead, which
tolerates early stream termination. Also strip accept-ranges since
without content-length clients can't issue range requests anyway.
HEAD responses still forward both headers unfiltered.

Fixes galaxyproject#22313
Copy link
Copy Markdown
Member

@dannon dannon left a comment

Choose a reason for hiding this comment

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

Looks good, clean fix.

@dannon dannon merged commit 5085c19 into galaxyproject:release_26.0 Apr 2, 2026
58 of 59 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in Galaxy Dev - weeklies Apr 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 2, 2026

This PR was merged without a "kind/" label, please correct.

@nsoranzo nsoranzo deleted the fix-proxy-streaming-headers branch April 2, 2026 14:34
@ahmedhamidawan ahmedhamidawan modified the milestones: 26.1, 26.0 Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants