react-native
react-native copied to clipboard
fix(#34627): forward Authorization header from original request on re…
…direct
Fix https://github.com/facebook/react-native/issues/34627
Summary:
IOS Specific issue. HTTP Authorization header is not passed to the sub-request when server responds with a 3xx code
Changelog:
[IOS] [FIXED] - Forward Authorization header from original request on redirect
Test Plan
- Start a bare project
- Install axios
- Create a simple http server with 2 endpoints where:
- Both endpoints requires authentication (using jwt for example)
- Endpoint A returns a redirect 307 to endpoint B
- Trigger an axios request to endpoint A
- Expected 200 response code from endpoint B
- Actual 401 response code from endpoint B
Additional information
It would be nice to have a little bit more control on this rule. Maybe limit header forwarding to urls with the same origin, or it applies if and only if an option is set at request creation (ex: forwardHeadersOnRedirect: true
)
Hi @srascar-bubble!
Thank you for your pull request and welcome to our community.
Action Required
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed
. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
Platform | Engine | Arch | Size (bytes) | Diff |
---|---|---|---|---|
android | hermes | arm64-v8a | 8,620,787 | +0 |
android | hermes | armeabi-v7a | 7,933,466 | +0 |
android | hermes | x86 | 9,106,793 | +0 |
android | hermes | x86_64 | 8,961,595 | +0 |
android | jsc | arm64-v8a | 9,186,843 | +0 |
android | jsc | armeabi-v7a | 8,377,136 | +0 |
android | jsc | x86 | 9,244,445 | +0 |
android | jsc | x86_64 | 9,502,916 | +0 |
Base commit: 9e5c963e2dbd90dbf2d260b67c2897e924be066e Branch: main
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
any update on this ?
Can we expand the fix to forward all of the original headers, as is specified in the fetch standard?
ref: https://github.com/whatwg/fetch/issues/553