如何重置(删除)存储设置的存储桶? (GCP)

发布于 2025-01-26 22:20:00 字数 514 浏览 3 评论 0原文

我写了 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设置

I wrote the CORS settings to "cors.json" file as shown below.

"cors.json":

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

Then, run the command below to set the CORS settings to my bucket as shown below:

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

Now, how can I reset(delete) the CORS settings?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

韬韬不绝 2025-02-02 22:20:00

您需要仅将“ []”写入 “ 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” ,没有“重置” “ delete” ,如下所示:

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

You need to write only "[]" to "cors.json" file as shown below:

"cors.json":

[]

Then, run the command below again to reset(delete) the CORS settings of your bucket as shown below:

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

Finally, if running the command below:

gsutil cors get gs://my-bucket

You will get this message below:

gs://my-bucket/ has no CORS configuration.

In addition, for "gsutil cors", there are only "set" and "get" as shown below:

gsutil cors set
gsutil cors get

So, for "gsutil cors", there are no "reset" and "delete" as shown below:

gsutil cors reset # Doesn't exist
gsutil cors delete # Doesn't exist
风吹短裙飘 2025-02-02 22:20:00

截至2022年,有一个命令可以清除水桶上的CORS配置。

gcloud storage buckets update gs://BUCKET_NAME --clear-cors

https://cloud.google.com/storage/storage/configuring-confore-configuring-confore-configuring-contorage-configuring-ecor- cors#disable-示例

As of 2022, there is a command to clear the CORS configuration on a bucket.

gcloud storage buckets update gs://BUCKET_NAME --clear-cors

https://cloud.google.com/storage/docs/configuring-cors#disable-example

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文