Fetch API headers not sent when end point redirects with HTTP 301
See original GitHub issueDescription
When making requests with custom headers (such as Authorization
), if the end point returns HTTP 302 FOUND, the fetch API will proceed to forward the request to a new URL however, the custom headers will not sent to the redirected URL.
Reproduction
- Make a request to any REST API that requires custom header with HTTP 302 response header
- Inspect the traffic
- First request includes custom header
- Forwarded request does not include custom header
Solution
A. Include header in redirected requests B. Add ability to intercept redirect responses
Additional Information
- React Native version: 0.36
- Platform: Both
- Operating System: MacOS
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
redirect after a fetch post call - Stack Overflow
If it is "follow", fetch() API follows the redirect response (HTTP status code = 301,302,303,307,308). If it is "error", fetch() API treats the ......
Read more >Redirections in HTTP - MDN Web Docs - Mozilla
Initial request goes from client to server. Server responds with a 301:moved permanently. There are several types of redirects, sorted into ...
Read more >Fetch Standard
A request goes in, a response comes out. The details of that operation are however quite involved and used to not be written...
Read more >Fetch API - The Modern JavaScript Tutorial
If we send a fetch , then by default it always sends the Referer header with the full url of our page (except...
Read more >next.config.js: Redirects
To only match a redirect when header, cookie, or query values also match the has field or don't match the missing field can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re experiencing the same issue on both platforms (using RN
0.42.3
)We also observed that this issue only occurs in IOS (android works).