Rack :: Deflater显然是gzip页面,但在浏览器中显示为乱码 [英] Rack::Deflater apparently gzip page but it appears as gibberish in browser
问题描述
新的堆栈不会自动提供gzip,所以我已经添加了
使用Rack :: Deflater
在我的 config.ru
使用以下命令通过curl来测试它:
curl -i -H'Accept-Encoding:gzip,deflate'http://carbuzz-production.herokuapp.com
返回一个包含内容编码
gzip
和a似乎压缩的身体。
在firefox或chrome中打开页面显示未翻译的内容(很多乱码)。
任何想法如何解决这个问题?
这有点傻。很显然,rails 3.1会自动使用Rack :: Deflater,所以我基本上是用gzipping两次...
我通过执行rake中间件来发现它。
我希望它有帮助。
I've deployed a rails 3.1 app on the new cedar stack on heroku. The new stack doesn't automatically provide gzipping so I've added
use Rack::Deflater
in my config.ru
Testing it through curl with the following command:
curl -i -H 'Accept-Encoding: gzip,deflate' http://carbuzz-production.herokuapp.com
Returns an header with content encoding
gzip
and a body that seems compressed.
Opening the page in firefox or chrome shows the body untranslated (lots of gibberish).
Any idea how to solve this?
This was a bit silly. Apparently rails 3.1 automatically uses Rack::Deflater so I was basically gzipping twice...
I discovered it by executing rake middleware.
I hope it helps anyway.
这篇关于Rack :: Deflater显然是gzip页面,但在浏览器中显示为乱码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!