0

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

how do i access the set cookies param in the response headers
I think server has to take care of setting the cookie appropriately and redirection Url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.