有什么方法可以从 heroku 提供 gzip 资产? [英] Any way to serve gzip assets from heroku?
问题描述
我想知道是否有任何方法可以让 Rails 网络服务器(瘦)为资产管道创建的 *.gz 文件提供服务.据我了解,这些压缩级别比 Rack::Deflater
的压缩级别更高,后者仅适用于机架文件中的 serve_static_assets
而不适用于 config.中间件
.
I'm wondering if there is any way to get the Rails webserver (thin) to serve the *.gz files the asset pipeline creates. As I understand, those have a higher compression level than that of Rack::Deflater
, which only works with serve_static_assets
from within the rackup file and not in config.middleware
.
一个不太理想的解决方案可能是更改 Zlib
的默认压缩级别,这是 Rack::Deflater
引用的内容.它应该只需要 gzip 一次,然后转到 Rack::Cache
,然后是 CDN.
A less optimal solution might be to change the default compression level of Zlib
which is what Rack::Deflater
references. It should only need to gzip once, then it goes to Rack::Cache
, then hopefully a CDN.
第二个不太理想的解决方案可能是 Rack::Rewrite
.
A second less optimal solution might be a Rack::Rewrite
.
推荐答案
您的问题的答案可以在 https 上找到://gist.github.com/2152663.
The answer to your question can be found at https://gist.github.com/2152663.
这篇关于有什么方法可以从 heroku 提供 gzip 资产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!