1

您好,我已经尝试了几天来解决我的跨域问题,但没有成功

我正在使用最新版本的谷歌云存储 API 并通过 gustils 设置我的 cors

gsutils cors sets cors.json gs://mybucket

这是我的 cors.json

[ 
  { 
    "origin": ["*"], 
    "method": ["GET", "HEAD", "DELETE", "PUT", "OPTIONS"], 
    "maxAgeSeconds": 1800, 
    "ResponseHeader": ["*"] 
  } 
]

但是由于某种原因,当我尝试通过我的网络表单上传我的文件并且之后我使用 xhr 时,我仍然遇到问题

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://storage.googleapis.com//buckettest/Kung-Fu-panda-21.jpg?GoogleAccessId=xxxxxxxxxh@developer.gserviceaccount.com&https://storage.googleapis.com//ilovemeteor/Kung-Fu-panda-21.jpg&Expires=86400&Signature=xxxxxxxxxxxxxxxxxxxx. This can be fixed by moving the resource to the same domain or enabling CORS.

我正在使用带有 PUT 的签名 url 方法

4

1 回答 1

2

好的,我在回到文档后设法解决了这个问题,但设法找到了一直在我眼前的错误。我想我需要一双新鲜的眼睛。

当我创建 URL 时,我在我的 url 中添加了一个额外的 /

于 2014-10-22T08:48:58.197 回答