gzip icon indicating copy to clipboard operation
gzip copied to clipboard

Add support for serving precompressed static files from ServeFile

Open suntong opened this issue 4 years ago • 4 comments

Thanks for providing this useful middleware first of all. 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

suntong avatar May 20 '20 14:05 suntong

Yes, I had this thought, that would be neat.

Need to figure out how to implement this.

Thanks for your advice.

nanmu42 avatar May 21 '20 01:05 nanmu42

Any update on this?

kashid16 avatar Sep 07 '20 08:09 kashid16

The FS and embed package is about to land in Go 1.16.

This may be a good news for this long-desired feature.

nanmu42 avatar Nov 28 '20 08:11 nanmu42