1.vue axios cross-domain request, the backend has been configured to allow cross-domain, and the agent also reported an error when accessing the cross-domain
2. Is the proxy access address configured or localhost
axios.defaults.headers.common ["Access-Control-Allow-Origin"] = "*";
axios.defaults.headers.post [" Content-Type"] = "application/x-www-form-urlencoded";
proxyTable: {
"/apis": {
target: "http://192.168.1.109/xxx/aa",
changeOrigin: true,
pathRewrite: {
"^/apis": ""
}
}
}
< hr >
this.$http.post ("/ apis/bbb/cccc", {
) json:JSON.stringify({})
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
3. An error was reported in the request result
Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.
Error: Request failed with status code 404
at createError (createError.js?16d0:16)
at settle (settle.js?db52:18)
at XMLHttpRequest.handleLoad (xhr.js?ec6c:77)