[XMLHttpRequest] Making HTTP requests to redirects.
See original GitHub issueI’m in the process of implementing an login against an oauth based third-party server. As part of the login procedure I need to make an HTTP requests to an endpoint that returns a 302 status code with new Location
header and vital session cookies that I need to intercept. Unfortunately the XMLHTTPRequest
and the fetch
API will automatically follow these redirect so there is no way of accessing or intercepting the required HTTP headers that contain authorization information.
So what I would like to suggest is:
- Add a non standard
nofollow = true
property to these API’s so we as users can handle the redirect logic our selfs. - Provide a much lower level HTTP interface much like Node’s
http
module so we can build our own requests modules and use the modules such asrequest
from npm. - Provide a
tcp
interface so we can add HTTP parsing and WebSocket frame parsing on top of it.
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Prevent redirection of Xmlhttprequest - Stack Overflow
If the response is an HTTP redirect: If the origin of the URL conveyed by the Location header is same origin with the...
Read more >XMLHttpRequest.responseURL - Web APIs - MDN Web Docs
The read-only XMLHttpRequest.responseURL property returns the serialized URL of the response or the empty string if the URL is null.
Read more >FollowRedirects in XMLHttpRequest - APIs - WICG
My proposal is to add back in the optional flag into XMLHttpRequest which would let the developer opt out of following redirects; perhaps ......
Read more >How to make HTTP requests using XMLHttpRequest (XHR)
To send an HTTP request using XHR, create an XMLHttpRequest object, open a connection to the URL, and send the request. Once the...
Read more >XMLHttpRequest synchronous request not handling redirects ...
The asynchronous request executes correctly (ends with code 200 after following the redirect). ... possible. When accessing 'http://google.com' you'll get a 301 ...
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
Yes the issue is not fixed, it just get automatically closed for some odd reason even though it’s valid report.
Hi there! This issue is being closed because it has been inactive for a while.
But don’t worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/xmlhttprequest-making-http-requests-to-redirects
ProductPains helps the community prioritize the most important issues thanks to its voting feature. It is easy to use - just login with GitHub.
Also, if this issue is a bug, please consider sending a PR with a fix. We rely on the community to provide bugfixes as the core team is focused on performance.