流星和谷歌云存储Cross Origin

时间:2014-10-21 10:30:31

标签: meteor cors google-cloud-storage gcloud

您好我已经尝试了几天来找出我的Cross-origin问题而没有任何成功

我正在使用最新版本的Google云端存储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的签名网址方法

1 个答案:

答案 0 :(得分:2)

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

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