任何方式来从heroku提供gzip资产? [英] Any way to serve gzip assets from heroku?

查看:136
本文介绍了任何方式来从heroku提供gzip资产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法让Rails web服务器(瘦)服务资产管道创建的 *。gz 文件。据我所知,它们的压缩比要高于 Rack :: Deflater ,它只适用于 serve_static_assets 从而不是在 config.middleware

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屋!

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