2

I am using reactjs library for the frontend. I will be making a post request using axios to the backend, the backend responds with status code 302. Expected behaviour is that it will make a redirect to that URL. But it is not happening. I have searched through various posts. Some say that axios will not do the page redirection.

So not sure how to handle 302 redirects in axios. Help needed.

PCK
  • 1,254
  • 6
  • 20
  • 37
  • I am assuming you are using react router for routing. There is a history object provided by the react router. You need to use 'push' function of that object. – Pardeep Sharma Nov 29 '19 at 12:00
  • 1
    I am not getting any URL that i can manually redirect to. Redirection is happening in backend which sends 302 – PCK Nov 29 '19 at 12:09
  • 1
    The almost same question was asked here and answered : https://stackoverflow.com/questions/63574485/how-to-get-the-redirected-response-from-axios/63575061 – uinstinct Aug 25 '20 at 19:40
  • The almost same question was asked here and answered : https://stackoverflow.com/questions/63574485/how-to-get-the-redirected-response-from-axios/63575061 – uinstinct Aug 25 '20 at 19:42

0 Answers0