4kn4zw
Last Updated: July 05, 2018
·
3.133K
· locks

Slim down HTTP responses

If you're using a Rack-based web framework you can very easily slim down your responses by compressing them.

To achieve this you just have to use the Rack::Deflater middleware, like so:

# config.ru
require 'rack'
require './app'

use Rack::Deflater

run Sinatra::Application

Yes, that's all there is to it!

Now any client that sets the Accept-Encoding: gzip,deflate header will benefit from smaller responses.

3 Responses
Add your response

13408

Thanks for this, now I wonder how could be possible to make Rack::Deflater add the Vary: Accept-Encoding header. Have you found this out yet?

over 1 year ago ·
18071

Thanks

over 1 year ago ·
30112

I have believe in the explore new things and this curiosity make me too much querious related of the where is this computer windows 10. But I love to choose now this good computer navigation. http://mycomputerwindows10.com. Here it means option that make the good platform for the learning areas.

3 months ago ·