CORS 错误:显示临时标头
我的后端在 Heroku 中运行,前端在 Vercel 中运行 Create React App。我尝试将它们放在与此处文档所述相同的域名下:
https: //vercel.com/support/articles/pointing-subdomains-to-external-services
但是出了点问题,你知道是什么吗?我做了设置:
我在前端代码中有以下 axios 设置:
axios.defaults.baseURL = "https://sp-poc.com/api/";
}
axios.defaults.withCredentials = true;
调用后端时出错:
axios({
method: "post",
url: "registerEmail",
data: {},
headers: {
"Content-Type": "application/json",
crossDomain: true,
},
})
My Backend runs in Heroku, frontend, Create React App in Vercel. I try bring them under the same domain name as docs says here:
https://vercel.com/support/articles/pointing-subdomains-to-external-services
But something wrong, do you know what? I did the settings:
I have following axios settings in frontend code:
axios.defaults.baseURL = "https://sp-poc.com/api/";
}
axios.defaults.withCredentials = true;
Got error when calling backend:
axios({
method: "post",
url: "registerEmail",
data: {},
headers: {
"Content-Type": "application/json",
crossDomain: true,
},
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论