fix(fetch): properly redirect non-ascii location header url#2971
Merged
mcollina merged 8 commits intonodejs:mainfrom Mar 21, 2024
Merged
fix(fetch): properly redirect non-ascii location header url#2971mcollina merged 8 commits intonodejs:mainfrom
mcollina merged 8 commits intonodejs:mainfrom
Conversation
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.
This relates to...
Rationale
The fetch function behaves differently from major web browsers(chrome, safari, firefox etc), and even CURL (with
-Loption).Here is a minimal reproducible URL I made: https://non-ascii-location-header.sys.workers.dev/redirect
Worker code
By accessing the address at https://non-ascii-location-header.sys.workers.dev/redirect directly
or https://non-ascii-location-header.sys.workers.dev/ first and then making a fetch request to the /redirect path using the developer tools leads to reaching https://non-ascii-location-header.sys.workers.dev/%EC%95%88%EB%85%95
which shows
pathname /%EC%95%88%EB%85%95as a result.However, using undici fetch function does not behave in the same way.
This issue can also be observed at chrome web store: https://chromewebstore.google.com/detail/gbgmenmdglilmbmemagekpeaodajbeei
I do not have an in-depth understanding of the fetch standard, so if this PR request violates the standard in any way, please feel free to close it.
Thank you.
Changes
Features
Bug Fixes
Breaking Changes and Deprecations
Status