question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fetch API headers not sent when end point redirects with HTTP 301

See original GitHub issue

Description

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

  1. Make a request to any REST API that requires custom header with HTTP 302 response header
  2. Inspect the traffic
  3. First request includes custom header
  4. 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:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
epzeecommented, May 2, 2017

We’re experiencing the same issue on both platforms (using RN 0.42.3)

2reactions
Jyrno42commented, Apr 25, 2017

We also observed that this issue only occurs in IOS (android works).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found