method one.
Background: Configure access-control-allow-origin: *,
Front: do not do anything, you can visit
Question: front-end request header will not bring the cookie, the background can not get the current session id (sesseionId)
Method Two.
Distal: requesting configuration withcreadential: true
eg:1/axios: axios.defaults.withCredentials = true
2、ajax:$.ajax({ url: 'xxx', type: 'put', xhrFields: { withCredentials: true }, crossDomain: true });
Background: the request processing CORS: https: //developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS
Method three:
Distal: configure the proxy (server requests the server does not cause inter-AS) whether vue, react are required to configure the proxy itself (because the proxy server is going to access different)
Background: no treatment
Question: Local access is no problem, but if the front-end, back-end code is deployed on a different server this is not possible, should be replaced by the second method.