Rack :: Deflater显然是gzip页面,但在浏览器中显示为乱码 [英] Rack::Deflater apparently gzip page but it appears as gibberish in browser

查看:175
本文介绍了Rack :: Deflater显然是gzip页面,但在浏览器中显示为乱码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在heroku上新的雪松堆栈上部署了一个rails 3.1应用程序。
新的堆栈不会自动提供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屋!

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