-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interceptor for 302 responses #980
Comments
Set |
I did that but i consider it a hack because after i get the redirect i need to manually request the location in the header |
Unfortunately it seems there is no other way, actually axios handles no redirects at all. The |
You can use |
I arrived here because I had a similar problem: the server was redirecting when the user was not logged in and I was trying to find a way to intercept it. But it turns out that, in my case, when I added a common header to every request telling that it is a XHR, the server started responding correctly. Just writing it down to maybe help another person with the same issue.
|
@matepaiva I have the same problem: and I do not know how to solve this, could you pls send more details about how to solve this? thks. |
My situation was similar to the one that @matepaiva describes, with the exception that sending the XHR request header had no effect on the redirection. After wrestling with it for awhile and reading the intelligent discourse on this thread, it became clear that there is no client-side solution to this problem. Nay; I had to modify the server-side API endpoint to check for The bottom-line seems to be: pass |
I am doing it manually but analyzing the my express server will do a simple redirect via but on client side browser simply fetches the login page and mark the request as completed (which it should), so not in interceptor I am checking this
|
@NishantDesai1306 it looks more like a workaround, but if passing |
Hi,
I have a problem with 302 responses, we need to access headers and cookies after the user authenticates the response comes with set-cookie and with a 302 status for redirection, we are using nodejs with custom cookie jar and we save cookies in interceptors but there is no interceptor for 302 responses.
Is there any solution to this?
The text was updated successfully, but these errors were encountered: