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.