Gzip compression

Has anyone managed to deploy with gzip compression from the controllers? I’m running into API Gateway response limits, and simple gzip would solve it. I have the Lambda returning gzipped content, which works fine when running the server from command line (tested in Chrome, response has Content-Encoding: gzip, and transferred size is much smaller than resource size), but the API gateway is messing up the content (I think it treats it as text vs binary); Chrome shows response status 200 but fails to decode the content.

My setup is pretty simple, in config/application.rb I added

config.middleware.use Rack::Deflater

That seems to do it. Any ideas for the API gateway setup?

When I tested the endpoint using the API gateway web console, with no headers the response is text (as expected), and if I add the header Accept-Encoding:gzip the response body comes back as with

#<Rack::Deflater::GzipStream:0x000055a131e34d60>

This is the same thing I get when testing with curl.