expressjs / serve-static

Serve static files
MIT License
1.39k stars 228 forks source link

Added support for serving static gzipped files. #58

Closed TheUltDev closed 8 years ago

TheUltDev commented 8 years ago

This PR adds support for serving gzipped files if they are found on disk, the client supports it, and the developer enables it explicitly.

I've added 4 test cases testing these conditions.

TuckerCowie commented 8 years ago

+1

goerwin commented 8 years ago

We definitely need this.

dougwilson commented 8 years ago

It looks like there is an issue with directory handling somewhere, because having a directory named /foo and a file next to that directory /foo.gz ends up redirecting requests for the directory foo to end up getting the file that is in foo.gz if the client accepts Gzip, otherwise the file redirect if the client does not accept Gzip.

dougwilson commented 8 years ago

Hi @Cavitt, I really appreciate the pull request and I hope you find my comments above useful. In general, we have not added this functionality due to not only the complexity, but that it has already been solved in a well-maintained module: https://github.com/code42day/connect-gzip-static