4

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 ''):
skayred
  • 10,603
  • 10
  • 52
  • 94

2 Answers2

1

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

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

ShiningRay
  • 1,008
  • 7
  • 12
0

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

Community
  • 1
  • 1
Fernando Fabreti
  • 4,277
  • 3
  • 32
  • 33