代码之家  ›  专栏  ›  技术社区  ›  Kai - Kazuya Ito

(Retool)查询:上传失败。这可能是由于存储桶上的CORS问题,因此请仔细检查您的CORS设置是否正确

  •  0
  • Kai - Kazuya Ito  · 技术社区  · 3 年前

    我无法将文件上载到 云存储 在…上 GCP 更换

    enter image description here

    查询:上传失败。这可能是由于 bucket,请再次检查您的CORS设置是否正确。

    事实上,我 使用下面的命令打开 云外壳 :

    vi cors.json
    

    然后,将下面的代码编写到 cors。json :

    [
      {
        "origin": ["https://myorigin.retool.com"],
        "method": ["*"],
        "responseHeader": ["Content-Type"],
        "maxAgeSeconds": 3600
      }
    ]
    

    最后,设置 cors。json 对于 在里面 云存储,GCP 运行以下命令:

    gsutil cors set cors.json gs://mybucket-bc123.appspot.com
    

    此外 访问控制 铲斗的 “细粒度” .

    enter image description here

    有什么解决方案可以上传文件到 云存储 在…上 GCP 从…起 更换 ?

    0 回复  |  直到 3 年前
        1
  •  2
  •   Kai - Kazuya Ito    3 年前

    添加 “负责人” 铲斗的 “细粒度” :

    [
      {
        "origin": ["https://myorigin.retool.com"],
        "method": ["*"],                
        "responseHeader": ["Content-Type", "x-goog-acl"],
        "maxAgeSeconds": 3600           // ↑↑↑ Here ↑↑↑
      }
    ]
    

    此外,如果 访问控制 铲斗的 “统一” :

    enter image description here

    “x-goog-acl” 不需要:

    [
      {
        "origin": ["https://myorigin.retool.com"],
        "method": ["*"],
        "responseHeader": ["Content-Type"],
        "maxAgeSeconds": 3600
      }
    ]
    
    推荐文章