Skip to content

Harden error page response merging to strip framing headers#15776

Merged
ematipico merged 1 commit intomainfrom
fix/bugbot-142
Mar 5, 2026
Merged

Harden error page response merging to strip framing headers#15776
ematipico merged 1 commit intomainfrom
fix/bugbot-142

Conversation

@matthewp
Copy link
Contributor

@matthewp matthewp commented Mar 5, 2026

Changes

  • Strips Content-Length and Transfer-Encoding headers from the original response before merging in mergeResponses(), matching the existing treatment of Content-type
  • Ensures framing headers from the original response do not carry over to a rendered error page that has a different body

Testing

  • Added unit tests in middleware-app.test.js verifying that Content-Length and Transfer-Encoding from middleware responses are not preserved when rendering 404/500 error pages
  • Non-framing custom headers (e.g. X-Custom) are confirmed to still be preserved

Docs

No docs changes needed.

@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: d1e6420

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 5, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 5, 2026

Merging this PR will not alter performance

✅ 18 untouched benchmarks


Comparing fix/bugbot-142 (d1e6420) with main (c808fd5)

Open in CodSpeed

@ematipico ematipico marked this pull request as ready for review March 5, 2026 11:35
@matthewp
Copy link
Contributor Author

matthewp commented Mar 5, 2026

lgtm (i'm not actually the author).

@ematipico ematipico merged commit e9a9cc6 into main Mar 5, 2026
43 of 44 checks passed
@ematipico ematipico deleted the fix/bugbot-142 branch March 5, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants