Skip to content

Conversation

jacwright
Copy link

Fixes #261 by creating a new response with mutable headers and avoiding duplicating the body. The correct fix for what 74f63ab#diff-a1624121bc1fee18f8a5c2b2f907f01ba9c56a50068007e4c5da2911e91ea6df was trying to achieve.

This doesn't have changelog or version bumps. Just wanted to share how the code should run. I have it successfully running in my project.

Fixes kwhitley#261 by creating a new response with mutable headers and avoiding duplicating the body. The correct fix for what kwhitley@74f63ab#diff-a1624121bc1fee18f8a5c2b2f907f01ba9c56a50068007e4c5da2911e91ea6df was trying to achieve.
@casertap
Copy link

casertap commented Feb 1, 2025

In my opinion, this is an absolute must have @kwhitley
Thank you so much @jacwright for this excellent work.
I discovered this issue through wrangler flagging that with this ERROR.

Screenshot from 2025-02-01 16-07-27

@alexkli
Copy link

alexkli commented Aug 26, 2025

Thanks! Ran into TypeError: Can't modify immutable headers. in a Cloudflare worker when using corsify and sending a redirect using Response.redirect(). This change fixes it. Would be great to merge!

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.

corsify creating unused readable stream

3 participants