【问题标题】:How to reset(delete) CORS settings for a bucket? (GCP)如何重置(删除)存储桶的 CORS 设置? (GCP)
【发布时间】:2022-06-27 21:50:18
【问题描述】:

我将CORS设置写入“cors.json”文件,如下所示。

“cors.json”

[
    {
      "origin": ["http://localhost:8000"],
      "method": ["GET"],
      "responseHeader": ["Content-Type"],
      "maxAgeSeconds": 3600
    }
]

然后,运行以下命令将CORS设置设置为我的存储桶,如下所示:

gsutil cors set cors.json gs://my-bucket

现在,我该如何重置(删除)CORS 设置

【问题讨论】:

    标签: google-cloud-platform cors google-cloud-storage bucket gsutil


    【解决方案1】:

    您只需将 "[]" 写入 "cors.json" 文件,如下所示:

    “cors.json”

    []
    

    然后,再次运行以下命令以重置(删除)存储桶的 CORS 设置,如下所示:

    gsutil cors set cors.json gs://my-bucket
    

    最后,如果运行下面的命令:

    gsutil cors get gs://my-bucket
    

    您将在下面收到此消息:

    gs://my-bucket/ 没有 CORS 配置。

    另外,对于"gsutil cors",只有"set""get"如下图:

    gsutil cors set
    
    gsutil cors get
    

    所以,对于"gsutil cors",没有"reset""delete"如下所示:

    gsutil cors reset # Doesn't exist
    
    gsutil cors delete # Doesn't exist
    

    【讨论】:

      猜你喜欢
      • 2022-10-13
      • 2017-08-23
      • 1970-01-01
      • 2017-09-21
      • 2017-09-05
      • 2023-03-21
      • 2016-02-06
      • 2021-12-28
      • 2021-12-03
      相关资源
      最近更新 更多