在 IIS7 中,gzip 压缩的文件不会保持这种状态
我已将 IIS7 配置为 gzip 静态内容。
http://www.coderjournal.com/2008/04/ iis-7-compress-javascript-gzip/
但是,这些文件不会“保持”gzip 状态。
这是我的用例:
- 请求 test.css 文件。它没有被 gzip 压缩。
- 几秒钟内再次请求。它被压缩。
- 等待 5 分钟。
- 再次请求 test.css 文件。它没有被 gzip 压缩。
这是没有意义的——如果原始文件没有改变,静态文件的 gzip 压缩版本不应该在所有后续请求中传递吗?
注意:我使用 Firefox 和 Firebug 通过检查 Content-Encoding 标头来验证 gzip 压缩的内容。
I have configured IIS7 to gzip static content.
http://www.coderjournal.com/2008/04/iis-7-compress-javascript-gzip/
However, the files don't "stay" gzipped.
Here's my use case:
- Request test.css file. It is not gzipped.
- Request it again within a few seconds. It is gzipped.
- Wait 5 minutes.
- Request test.css file again. It is not gzipped.
This doesn't make sense -- shouldn't the gzipped version of a static file be delivered on all subsequent requests, if the original did not change?
Note: I am using Firefox and Firebug to verify gzipped content by checking the Content-Encoding header.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据这篇文章:
在 IIS7 中,内容根据其点击频率进行压缩,可如下配置:
也许您没有达到这些阈值?
According to this article:
In IIS7, content is compressed depending on it's hit frequency which is configurable like this:
Maybe you're not hitting these thresholds?
根据您需要优化网站性能的程度,您可能需要使用 Combres 来代替。
最大的优点是,它只对您的 javascript 文件进行压缩和 gzip 压缩,但它还将所有文件合并为一个,因此您的所有 javascript 文件只有一个 http 请求。此外,它还利用客户端缓存,以便仅在需要时下载文件。此外,它还对 CSS 文件执行所有这些操作。
设置起来非常容易,因此与其尝试解决此问题,不如将时间花在获取 Combres 上。
Depending on how badly you need to optimize performance on your site, you might want to use Combres instead.
The big advantage is that it does only only minify and gzip your javascript files, but it also combines all files into one, so there is only one http request for all your javascript files. In addition, it also makes use of client-side caching, so that the file is only downloaded when necessary. Also, it does the all this for CSS files as well.
It's quite easy to set up, so instead of trying to fix this, your time might be better spent on getting Combres instead.
我建议你关注另一个软件——Helicon Ape http://www.helicontech.com/ape
它对 3 个网站免费,并包含运行顺利的压缩/缓存解决方案。只需一串配置,您就可以启用 gzip 和缓存:
上面的规则告诉 Ape 以最高级别压缩 text/* mime 类型并将它们缓存在内存中。尝试一下吧。
I would suggest you to pay attention on another software—Helicon Ape http://www.helicontech.com/ape
It’s free for 3 web-sites and includes compression/caching solutions which work smoothly. Just in one string of configuration you will get gzip and cache enabled:
The rule above tells Ape to compress text/* mime-types with the highest level as well as cache them in memory. Just give it a try.