I have an application running behind a proxy, both on the same machine. Which approach is more suited regarding compression, while preserving reasonable performance.turn on compression at the application level (which happens to be in nodejs)leave it out to the proxy (which is nginx)
Turn on gzip on nginx, upstream (nodejs) or both?
node.js;compression
While this is probably a better question for ServerFault, I believe there is a clear answer: do compression on nginx.There are a couple of reasons for this:Compression is moderately CPU-intensive, and Node is single-threaded. Therefore, compression in node will potentially reduce the total number of requests a single server is able to handle.You will almost certainly use nginx to serve static assets such as JavaScript, CSS, images, and static HTML. Which you will want to compress. So why not compress everything that goes through nginx, including forwarded traffic?As for both: that's just wasted CPU.