-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
fix(react-router): Remove Content-Length Header from Single Fetch Responses to Prevent Errors #13658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: d3dedb6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
you should remove the content length header in the redirect function instead |
* docs(GOVERNANCE): fix typos + grammar * Revert a few words --------- Co-authored-by: Brooks Lybrand <brookslybrand@gmail.com>
…13764) Co-authored-by: Tim Dorr <timdorr@users.noreply.github.com>
Co-authored-by: Tim Dorr <timdorr@users.noreply.github.com>
Didn't realize this would be formatted. Fixing to the formatted line number.
* docs: add accessibility documentation from Remix docs * Update docs/how-to/accessibility.md * Update docs/how-to/accessibility.md --------- Co-authored-by: hlimas <hlimas@ebay.com> Co-authored-by: Brooks Lybrand <brookslybrand@gmail.com>
* Cleanup spa.md intro * Add concurrency doc from Remix docs * Tweak some wording
* Finish blocker doc * Update docs/api/hooks/useBlocker.md Co-authored-by: Michaël De Boey <info@michaeldeboey.be> --------- Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
* docs: add quick start doc for framework mode * docs(quickstart): refine language and improve clarity in quick start guide
…umentation (remix-run#13895) * docs: add reference to meta function return types in route module documentation * add mobregozo to contributors list
…g with `ssr` set to `false` (remix-run#13699)
* Update react-router.config.ts * add lazy route discovery doc * Update react-router.config.ts.md * Remove incorrect performance point --------- Co-authored-by: Matt Brophy <matt@brophy.org>
…/react-router into fix-content-length-issue
This reverts commit 718f86d.
uh oh. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes: #12850
minimal reproduction: https://stackblitz.com/edit/github-pejjugrp?file=app%2Froutes%2Fhome.tsx
While investigating the cause of this issue, I discovered an interesting behavior: removing the Content-Length header from the response results in the application functioning correctly.
Upon further examination, I found the following description in the documentation for Node.js's http module:
In fact, when setting a clearly insufficient value such as Content-Length: 6, the response body appears to be affected accordingly.
As described in the issue, this becomes problematic when using response headers intended for redirect responses—such as those generated by authentication libraries—which often do not include a response body.
After considering how best to address this, I concluded that, regardless of whether the response is a redirect, the use of turbo-stream encoding can alter the expected body. Therefore, the most robust solution would be to remove the Content-Length header from all Single Fetch responses, which is what this PR implements.
Additional Notes:
There is a comment on the issue stating that the bug occurred in the development environment but not in production(node20, SSR enabled) . I have yet to determine the reason for this discrepancy.
Nevertheless, since I was able to reliably reproduce and fix the bug, I am submitting this pull request.