首页 > 解决方案 > 仅设置 CORS Google Cloud Storage 存储桶

问题描述

我在我的存储桶上设置了 CORS 策略以允许来自我的云功能的请求,

gsutil cors get gs://my-project.appspot.com

返回:

[{"maxAgeSeconds": 3600, 
"method": ["GET"], 
"origin": ["https://us-central1-my-project.cloudfunctions.net"], 
"responseHeader": ["Content-Type"]}]

但是,当我尝试从我的云功能访问资源时,我收到以下错误:

从源“ https://us-central1-my-project.cloudfunctions.net ”访问“ https://storage.cloud.google.com/my-project.appspot.com/mydata.csv ”的 XMLHttpRequest被 CORS 策略阻止:请求的资源上不存在“Access-Control-Allow-Origin”标头。

我不知道从这里去哪里。我怎样才能解决这个问题?

标签: corsgoogle-cloud-storagegsutil

解决方案


推荐阅读