Rack::Deflater 显然是 gzip 页面,但在浏览器中显示为乱码

发布于 2024-12-16 17:16:49 字数 396 浏览 4 评论 0原文

我已经在heroku 上的新cedar 堆栈上部署了rails 3.1 应用程序。 新堆栈不会自动提供 gzipping,因此我

config.ru 中添加了 use Rack::Deflater

使用以下命令通过curl 进行测试:

curl -i -H 'Accept-Encoding: gzip,deflate' http://carbuzz-production.herokuapp.com

返回标头使用内容编码 gzip和看起来压缩的正文。 在 Firefox 或 Chrome 中打开页面会显示未翻译的正文(很多乱码)。

知道如何解决这个问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

誰ツ都不明白 2024-12-23 17:16:49

这有点傻。显然rails 3.1自动使用Rack::Deflater所以我基本上gzipping两次......

我通过执行rake中间件发现了它。

无论如何我希望它有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文