Google云存储控制台Content-Encoding到gzip [英] Google cloud storage console Content-Encoding to gzip

查看:107
本文介绍了Google云存储控制台Content-Encoding到gzip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Cloud Storage控制台上传文件.我没有使用任何命令行工具. 我想在元数据中将Content-Encoding设置为gzip(-z选项).

I am using Google Cloud Storage console to upload files. I am not using any command line tool. I want to Set the Content-Encoding to gzip (-z option) in Metadata.

请参见下面的屏幕截图,值'z'是否正确?

Please see below screenshot, is value 'z' is correct or not?

我为所有css和js文件设置了值"z",并在PageSpeed Insights上分析了网页. PageSpeed Insights仍告诉我启用压缩,请检查以下屏幕截图.

I have set value 'z' for all css and js files, and analyzed webpage on PageSpeed Insights. PageSpeed Insights still telling me enable compression, please check below screenshot.

我正在将Nginx Web服务器与Debian 7上安装的HttpGzipModule一起使用.

I am using Nginx webserver with HttpGzipModule installed on Debian 7.

谢谢.

推荐答案

-z"是gsutil命令行工具的功能-它将数据本地压缩并使用Content-Encoding:gzip将其上传到GCS.它不是HTTP协议或Google Cloud Storage的功能(或属性),因此仅设置标头并不能满足您的需求.

"-z" is a feature of the gsutil command line tool -- it compresses the data locally and uploads it to GCS with Content-Encoding: gzip. It is not a feature (or property) of the HTTP protocol or Google Cloud Storage, hence simply setting the header does not achieve what you are going for.

如果您要存储(和提供)gzip编码的数据,则有两个选择:

If you want to store (and serve) gzip-encoded data, you have two options:

  1. 例如使用gzip Unix工具在本地应用gzip-compression.然后从文件名中删除.gz后缀,并使用"Content-Encoding:gzip"标头和相应的Content-Type(例如,对于CSS,"text/css",对于js是"application/javascript")上传. /li>
  2. 使用带有-z标志的gsutil工具,它将为您完成以上所有工作.
  1. Apply gzip-compression locally, for instance with the gzip Unix tool. Then remove the .gz suffix from the file name and upload it with the "Content-Encoding: gzip" header and the appropriate Content-Type (e.g., "text/css" for css, "application/javascript" for js).
  2. Use the gsutil tool with the -z flag, and it will take care of all of the above for you.

这篇关于Google云存储控制台Content-Encoding到gzip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆