I have rails 3.2.1 application and nginx.
In nginx configurations I set gzip on;
, and compressing works for pages, css, js files.
But it does not work for JSON responses. As I found the solution for rails is to add: config.middleware.use Rack::Deflater
into application.rb.
And it helps: before response was 45Kb, now near 8Kb.
But, now I found that compression works only in Mac Chrome, Mac Firefox and Windows Chrome.
For IE 10, IE 11 and Windows Firefox - it does not work:
- I see
Accept-Encoding: gzip, deflate
in request-header, - I don't see
Content-Encoding: gzip
in response-header, - response size is still 45Kb.
Please, help.
gzip_types
to includeapplication/json
– Czernowitzconfig.middleware.use Rack::Deflater
in application.rb after addingapplication/json
togzip/types
? – Impenetrable