【发布时间】:2017-10-10 05:54:13
【问题描述】:
当我执行这段代码时,我得到了Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
axios({
url: this.state.optImage[i],
method: 'get',
withCredentials: true,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'https://*, http://*',
}
})
我请求到 s3 服务器,在邮递员中,它运行良好。 我还尝试在“Access-Control-allow-Origin”中添加“*”。 我的代码有什么问题?仅在本地主机中发生吗?我完全不明白。
【问题讨论】: