【发布时间】:2021-09-15 13:09:43
【问题描述】:
在我的 json 文件中设置 cors 配置后,我仍然不断收到错误响应,以下是我的配置和响应。拜托,需要你的帮助,我已经为此奋斗了好几天。
[
{
"origin": ["*"],
"responseHeader": ["X-Requested-With", "Access-Control-Allow-Origin", "Content-Type"],
"method": ["GET", "HEAD", "DELETE", "OPTIONS"],
"maxAgeSeconds": 3600
}
]
这是我的 fetch api:
fetch('https://storage.googleapis.com/bucketName/photos/608d04ab0d1bd21fb4e94876/02-07-2021/SGNArtboard-1[751].png')
.then(function(response) {
return response.blob()
})
.then(function(blob) {
console.log('blob : ', blob)
});
这是我的错误回复:
Access to fetch at 'https://storage.googleapis.com/bucketName/photos/608d04ab0d1bd21fb4e94876/02-07-2021/SGNArtboard-1[751].png' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
【问题讨论】:
标签: node.js reactjs google-cloud-platform frontend next.js