WithCredentials problem of axios

problem description

I want to bring cookies across domains. Why doesn"t withCredentials: true work?

the environmental background of the problems and what methods you have tried

I"ve tried axios.defaults.withCredentials = true to work.
but why does it not work when configured separately?

related codes

axios.post("http://101.132.138.141:8888/service/pageUsers", objectToForm({
        "currentPage": "1",
        "pageSize": "10",
        "token": "7e987daa-6c84-46d2-be26-f345dfaed8a7",
    }), {
        // 
        withCredentials: true
    })
    .then(function(res) {
        console.log(res.data);
    })
    .catch(function(err) {
        console.error(err);
    });
What is the error message that

actually sees?

intercepted cross-source requests: the same origin policy forbids reading of remote resources located in http://101.132.138.141:8888/service/pageUsers. (reason: "Access-Control-Allow-Origin"" is missing in the CORS header).
The

backend has set the CORS header, but because it is not attached with cookies , it is intercepted by the interceptor.

Mar.31,2021
In the case of

withCredentials, the backend should set Access-Control-Allow-Origin as your source address, such as http://localhost:8080, not *, but also set header ('Access-Control-Allow-Credentials: true');

Menu