静态Amazon S3文件上的GZIP压缩 [英] GZIP Compression on static Amazon S3 files

查看:946
本文介绍了静态Amazon S3文件上的GZIP压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上实施 GZIP 压缩。我已经在 IIS 上实现了它,并且 HTML页面已按预期成功压缩

I would like to implement GZIP compression on my site. I've implemented it on IIS and the HTML page is compressed successfully as expected.

现在问题出在 CSS和JS 文件中,我从 Amazon S3 获得。它们根本没有被压缩。我也想压缩它们。

Now the issue is with CSS and JS file, which I get from Amazon S3. They are not at all compressed. I wanted to compress them too.

请指导我如何操作。分享它的链接对我有很大的帮助。

Please guide me how to do it. Sharing links for it help me a lot.

更新:我已经将S3文件上的Meta Header添加为Content-Encoding:gzip,现在它在Response标题中显示。文件大小仍然相同,页面中特定CSS没有影响。我甚至无法在浏览器中打开它。以下是特定CSS的链接

Update: I've added Meta Header on S3 files as "Content-Encoding:gzip", now its showing in Response header. Still the file size is same and no effect of Particular CSS in page. And i can't even open it in browser. Here is the link of particular css.

谢谢

推荐答案

文件应该在之前压缩被上传到Amazon S3。

Files should be compressed before being uploaded to Amazon S3.

有些例子,请参阅:

  • Serving Compressed (gzipped) Static Files from Amazon S3 or Cloudfront
  • How to: Gzip compression of CSS and JS files on S3 with s3cmd

这篇关于静态Amazon S3文件上的GZIP压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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