cas login 302 does not jump problem

First of all, a problem is clarified, that is, ajax requests cannot accept 302 to directly jump to the front-end browser address.

It is also said that ajax can get a 302 status after a successful return. The result of my test is that the browser has already intercepted and processed it in the upper layer.

 

The solution steps are as follows:

1. The front-end ajax request requires an interface for cas verification, cas judges that it is not logged in, returns 302, and returns the login page address in location.

2. Because the ajax request will not handle this 302 jump normally.

3. The front-end js will pull down all the page strings in the location through the get request of ajax.

//In this way, the front end is stuck and cannot jump to the login page normally.

4. At this time, because js will pull up all the page html through ajax, the front end will have a processing opportunity,

Intercept this ajax request by parsing the json error.

5. After intercepting this step, js directly requests an interface that requires cas verification through location.href.

6. At this time, the server will return to the login page of the 302 jump, because this time it is directly by changing the browser url,

So the browser handles the 302 jump address normally.

7. The page will successfully jump to the login page of cas.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326771306&siteId=291194637