4kn4zw
Last Updated: April 15, 2019
·
3.243K
· 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.

4 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 ·
30869

The compressing teaching skills and approves the wonderful college preparing tips and more essay services as well. Basically this https://www.bestessayservicereviews.com/ site has been developing and improving the skills and sharing achieved tips.

7 months ago ·
32498

Do you have a problems for finding a best online playing game, you have like to follow this link https://myeuchre.com you are absolutely enjoying on your moment, see more than interesting things in there homepage.

30 days ago ·