Thin GZIP decoder on the local machine

I am using a thin Rails server and I want to send some gzipped JSON data, but in localhost it crashes with a MultiJson error (unknown characters).

How to enable gzip support for local thin use 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 ''): 
+4
source share
2 answers

The rack includes middleware called Rack::Deflater that you want.

enable config.middleware.use Rack::Deflater in config/application.rb

+1
source

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

If you serve assets through Rails, do the following:

config /application.rb

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

Link

0
source

Source: https://habr.com/ru/post/1383020/


All Articles