user2067736
user2067736

Reputation: 1675

angularjs interceptor for status code 302 not able to read response header set-cookie

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

Answers (1)

Amitesh
Amitesh

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

Related Questions