How do I enable GZIP compression on the new Heroku Cedar stack? This is straight from their site:
Since requests to Cedar apps are made directly to the application server – not proxied through an HTTP server like nginx – any compression of responses must be done within your application. For Rack apps, this can be accomplished with the Rack::Deflater middleware. For gzipped static assets, make sure that Rack::Deflater is loaded before ActionDispatch::Static in your middleware stack.
If I'm reading this correctly, my Python application code is now responsible for gzipping the responses? How would I go about compressing my static assets (e.g. css/js)? I'm using Flask and GUnicorn.
You just need a wsgi middleware that gzips the response. See Gzipping all HTTP traffic with Pyramid or http://librelist.com/browser//flask/2010/6/14/gzip-compression/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With