Hello, I'm trying to write a http handler to serve gzipped files but if the client does not accept the gzip content-encoding, it falls back to identity.
I see three ways to do this. First is dynamic gzipping. If a client supports it and a file is gzippable, I gzip the file on the fly and then serve it. Interestingly, I noticed that google does the opposite. They have the gzipped versions of the files stored, but when a client does not accept the gzip content-encoding, the server decompresses the gzipped file on the fly and serves that. This first method is attractive because it is simple to implement but it can be CPU intensive. Second is static gzipping on the file system, e.g. storing .gz files next to regular files. Another variation on this might be to have a second root folder, one which contains the gzipped files. This is attractive because you can gzip files at the highest compression level to save the most on bandwidth but it requires some setup. Third is a combination of the first two, gzipping files as they are requested and storing them in an in memory cache and serving subsequent requests to clients that accept the gzip content-encoding from there. This combines the simplicity of the first option with the performance benefits of the second option but it is significantly more complex to write the code. Which do you think is the best option? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.