Reputation: 1675
the service/backend is sending me set-cookies in a 302 redirect but i am not able to read the response header which has set-cookies. basically i want to redirect the user to login page and clear the session if Set-Cookie:redirectURL="" and it expires immediately. Not sure how to proceed.
Upvotes: 0
Views: 776
Reputation: 1517
I am afraid you can't intercept the 302 status code from JavaScript.
This is because the status 302
simple means request is not yet fulfilled and server is asking the user agent to initiate a new request for the Url specified in Location header of redirection response.
This entire redirection process is internal to the user agent and JavaScript code is notified only on completion of the request.
Upvotes: 2