使用自定义URL时,Content-Type标头丢失

时间:2013-02-28 11:51:15

标签: google-cloud-storage

我在Google云端存储上托管FireFox插件。为了由FireFox正确处理,需要将Content-Type设置为application / x-xpinstall

我上传的内容如下:

gsutil -h "Content-Type: application/x-xpinstall" cp -a public-read \
   ActivityInfo.xpi gs://download.activityinfo.org

从标准端点访问时,一切正确:

$ curl -s -D - http://commondatastorage.googleapis.com/download.activityinfo.org/ActivityInfo.xpi \ 
     -o /dev/null

HTTP/1.1 200 OK
Server: HTTP Upload Server Built on Feb 13 2013 15:53:33 (1360799613)
Expires: Thu, 28 Feb 2013 12:38:30 GMT
Date: Thu, 28 Feb 2013 11:38:30 GMT
Last-Modified: Thu, 28 Feb 2013 11:38:01 GMT
ETag: "1ee983889c947a204eab4db6902c9a67"
x-goog-generation: 1362051481261000
x-goog-metageneration: 1
Content-Type: application/x-xpinstall
Content-Language: en
x-goog-crc32c: a11b93ab
Accept-Ranges: bytes
Content-Length: 5562
Cache-Control: public, max-age=3600, no-transform
Age: 491

但是当我尝试从自定义域download.activityinfo.org访问时,标头将恢复为application / octet-stream

$ curl -s -D - http://download.activityinfo.org/ActivityInfo.xpi -o /dev/null       
HTTP/1.1 200 OK
Server: HTTP Upload Server Built on Feb 13 2013 15:53:33 (1360799613)
Expires: Thu, 28 Feb 2013 12:10:24 GMT
Date: Thu, 28 Feb 2013 11:10:24 GMT
Last-Modified: Wed, 27 Feb 2013 20:36:24 GMT
ETag: "1ee983889c947a204eab4db6902c9a67"
x-goog-generation: 1361997384772000
x-goog-metageneration: 2
Content-Type: application/octet-stream
x-goog-crc32c: a11b93ab
Accept-Ranges: bytes
Content-Length: 5562
Cache-Control: public, max-age=3600, no-transform
Age: 2298

我已按照文档

将CNAME设置为c.storage.googleapis.com
$ nslookup download.activityinfo.org
Non-authoritative answer:
Server:  Comtrend.Home
Address:  192.168.1.1

Name:    storage.l.googleusercontent.com
Addresses:  2a00:1450:400c:c00::80
          173.194.78.128
Aliases:  download.activityinfo.org
         c.storage.googleapis.com

这是一个错误还是我需要更改配置?

1 个答案:

答案 0 :(得分:1)

上面的两个结果在x-goog-generation和x-goog-metageneration中有不同的值,这让我怀疑你已经多次上传了这个对象,并且你看到了不同版本的结果(它们有不同的值) for Content-Type)。您是否为存储桶启用了版本控制?如果没有,那么可能在其中一条路径中进行了一些缓存。你还在看这种行为吗?