Middleware ordering with Rack::Deflater (via Honey, I Shrunk the Internet!)

@djcp and others,

In response to this old blog post:

I was wondering if any Heroku-using developers have had issues with the location of Rack::Deflater in the Rack middleware stack. I was debugging an issue with the rack-dev-mark gem a couple weeks ago and it turned out the problem was the location of their rack middleware in relation to the gzipping of Deflater.

Other than some hits on problems when using profiling tools like mini-profiler, the Goog hasn’t been very useful in determining if there is an optimal (or unsafe) place to stick Rack::Deflater in the middleware stack. Does anyone set a specific location for Deflater in their stack?

I believe you want the gzipping (and any middleware setting cache headers) to come after anything that would modify the response body.