skayred
skayred

Reputation: 10713

Thin GZIP decode on local machine

I'm using thin as a Rails server, and I want to send some JSON data gzipped, but in localhost it falls with MultiJson error (unknown symbols).

How can I enable gzip support for local thin using without nginx or apache?

Error text:

15:46:09 web.1     | Started PUT "/api/me" for 192.168.192.8 at 2011-11-25 15:46:09 +0600
15:46:09 web.1     | Error occurred while parsing request parameters.
15:46:09 web.1     | Contents:
15:46:09 web.1     | 
15:46:09 web.1     | 
15:46:09 web.1     | MultiJson::DecodeError (743: unexpected token at ''):

Upvotes: 4

Views: 635

Answers (2)

Fernando Fabreti
Fernando Fabreti

Reputation: 4366

As a rack middleware, I think Rack::Deflater it will work with other WebServers

If you are serving assets thru Rails, do this:

config/application.rb

config.middleware.insert_before ActionDispatch::Static, Rack::Deflater

Reference

Upvotes: 0

ShiningRay
ShiningRay

Reputation: 1008

Rack includes a middleware called Rack::Deflater which is what you want.

include config.middleware.use Rack::Deflater in your config/application.rb

Upvotes: 1

Related Questions