Gzip
Content-Type: *
Gzip is a method of compressing files (making them smaller) for faster network transfers. It is also a file format. Compression allows your web server to provide smaller file sizes which load faster for your website users. Enabling gzip compression is a standard practice. https://en.wikipedia.org/wiki/Gzip
To enable compression on all server's responses and requests use the iris.Compression
middleware:
If the client does not accept an encoding then it will write the contents as they are, without compression.
When you want control over it you can use the Context.CompressWriter(enable bool)
method before sent the response:
There is also the Context.ClientSupportsEncoding(s ...string) bool
method which reports if the client does accept and support gzip encoding:
Last updated