Compress request answers

Hi,

Within a girder plugin, I created a new route that generates a large json output (betwen 1MB and 10MB).
Is there some nice way to get my output gzipped ?

The only way I saw would be to teach _createResponse to support the “Accept-Encoding” request header ? But I’m not sure if it is a good idea to compress all requests as soon as the browser supports “Accept-Encoding”.

What do you think ?

Thanks,
Julien.

Hi J2,

I would recommend doing this with your reverse proxy for production. Nginx example: http://nginx.org/en/docs/http/ngx_http_gzip_module.html

In that module there are a number of configuration options to control how & when compression is applied.

Thanks Zach, I’ll give it a try.