Closed suntong closed 4 years ago
I added support for what you request into this module: https://github.com/lpar/gzipped
Then I chain nytimes/gziphandler
with lpar/gzipped
to obtain both functionalities at the same time: dynamic content compression and static file compression serving.
I did this to add HTTP compression in Portainer: https://github.com/hhromic/portainer/commits/http-gzip (see last three commits).
Hope this is useful.
Thanks a lot Hugo!
I'm wondering if the Static files from
http.ServeFile
method is also supported. Especially,It would also be 'nice to have' if the http.ServeFile method would check for the presence of xxx.gz and serve it if present and the accept header includes gzip. This is a trick that nginx does and it greatly accelerates the serving of static css, js etc files because they can be compressed just once during the build process. There's the added benefit too that they are smaller files to read, as well as needing fewer bytes on the wire
thanks