You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the code I used, where I tried to encode the redirect URL to try and somehow resolve it (obviously the simpler version doesn't work as well)
Example Code
constaxiosInstance=axios.create({maxRedirects: 5,responseType: 'arraybuffer'});try{constresponse=awaitaxiosInstance.get('https://chromewebstore.google.com/detail/bleabhffpgoeopcfeapggnbdlhklbajk',{headers: {'User-Agent': userAgent,'Content-Type': 'text/html; charset=UTF-8','Accept-Language': 'en-US,en;q=0.5'}});returnresponse.data;}catch(error){if(error.response&&error.response.status===302){constlocation=error.response.headers.location;console.log('Original redirect URL:',location);// Split the URL into its componentsconsturlParts=location.split('/');// Find the index of the "detail" partconstdetailIndex=urlParts.findIndex(part=>part==='detail');if(detailIndex!==-1&&detailIndex+1<urlParts.length){// Encode the part after "detail"urlParts[detailIndex+1]=encodeURIComponent(urlParts[detailIndex+1]);// Join the URL parts back togetherconstmodifiedLocation=urlParts.join('/');console.log('Modified redirect URL:',modifiedLocation);// Send a new request with the modified URLconstresponse=awaitaxiosInstance.get(modifiedLocation,{headers: {'User-Agent': userAgent,'Accept-Charset': 'UTF-8','Content-Type': 'text/html; charset=UTF-8'}});returnresponse.data;}else{thrownewError('Invalid URL format');}}else{throwerror;}}}
Expected behavior
Successful redirect is expected without entering an infinite loop (the infinite loop imo is caused by faulty encoding of the redirect)
Axios Version
^0.21.1
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
21.7.3
OS
Linux
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered:
Describe the issue
I'm trying to fetch the following url using Axios on NodeJS: https://chromewebstore.google.com/detail/bleabhffpgoeopcfeapggnbdlhklbajk
When doing so with Axios, I'm getting ERR_FR_TOO_MANY_REDIRECTS. When looking at the error carefully, to me it seems like it's possibly because of faulty encoding of the redirected URL, as eventually it should result to https://chromewebstore.google.com/detail/%E5%85%AD%E7%9C%81%E5%8F%91%E6%96%87/bleabhffpgoeopcfeapggnbdlhklbajk (with Chinese chars if entered in the browser).
I tried many many things, including using Axios interceptors to reencode the URL, but nothing works.
Surprisingly, everything works when using curl (curl -L https://chromewebstore.google.com/detail/bleabhffpgoeopcfeapggnbdlhklbajk) or python requests (requests.get(' https://chromewebstore.google.com/detail/bleabhffpgoeopcfeapggnbdlhklbajk').
Here's the code I used, where I tried to encode the redirect URL to try and somehow resolve it (obviously the simpler version doesn't work as well)
Example Code
Expected behavior
Successful redirect is expected without entering an infinite loop (the infinite loop imo is caused by faulty encoding of the redirect)
Axios Version
^0.21.1
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
21.7.3
OS
Linux
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: