I don't want to use a library which gzips on the fly, because of the overhead.
The website has some dynamic components which is implemented in node.js.
I have some static js and css files as well as their gzipped counterparts. I want to serve the gzipped version only to browsers which support it.
I considered using the static middleware in express to serve the static files, along with some URL rewriting middleware to conditionally serve the gzipped files. However, I cannot find any conditional rewrite module.
I cannot believe that no one has done this, or that it needs so many work arounds. What am I missing?
On a different note, is serving up static files via node.js too expensive? On the other hand, using Apache for static files and running node.js behind seems bad as well. What is the least stupid configuration for AWS EC2 hosting?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…