【发布时间】:2021-08-29 19:35:42
【问题描述】:
错误截图
发布请求代码 (Vuejs)
let PROXY = "http://localhost:8080/";
let URL = PROXY + "api/security/oauth/token?grant_type=client_credentials"
URL += `&client_id=${this.ID}`;
URL += `&client_secret=${this.SECRET}`;
try {
let res = await axios.post(URL, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
console.log(res);
}
catch(err) {
console.log(err);
}
Vue.config.js(代理设置)
module.exports = {
devServer: {
proxy: {
'https://outpost.mapmyindia.com/': {
target: "http://localhost:8080/",
changeOrigin: true
}
}
},
transpileDependencies: [
'vuetify'
]
}
我最初遇到了与 CORS 相关的错误,所以我使用了这个代理,但即便如此我也收到了这个错误。 StackOverflow 上发布了一些与 vuejs 中的代理设置相关的问题,以消除 CORS 错误,但没有一个可以解决此问题,因此我发布了此问题。
【问题讨论】: