[Google Cloud Storage-设置元数据

问题描述 投票:0回答:1

我在使用Google Cloud Bucket时遇到问题。当我在Google Cloud上调用文件时,它们带有标头privatemax-age=0,因此没有缓存选项。

我使用控制台设置元数据选项。我输入:

gsutil -m setmeta -r "Cache-Control:public, max-age=3600" gs://bucket/folder*

但是它不起作用。我该怎么办?这对我来说是一个可怕的问题。

google-cloud-platform google-cloud-storage
1个回答
0
投票

gsutil命令为link

gsutil setmeta -h [header:value|header] ... url...

以下命令对我有用:

gsutil -m setmeta -h "Cache-Control:public, max-age=3600" gs://destination/object

-h指定要从每个命名对象添加的header:value或要删除的header。

您可以使用with命令使用通配符,例如所有对象:

gsutil -m setmeta -h "Content-Type:image/jpeg" gs://YOUR_BUCKET/**/*
© www.soinside.com 2019 - 2024. All rights reserved.