4 ms·
Yes, I agree with the best practice in general, but this may not apply when the memory is very small (2Go). The speed improvement achieved by reducing memory fo
by reacweb 9y ago
Yes, I agree with the best practice in general, but this may not apply when the memory is very small (2Go). The speed improvement achieved by reducing memory footprint is a clear benefit. The benefit of a better mitigation of bad clients performed by nginx is less clear for me (I welcome any argument to change my mind). The surface attack seems similar (one port).
- danpalmer 9y agoNginx will generally be pretty low memory. I know on our web servers we've bumped all the cache sizes quite significantly (10-100x the default) because it's optimised for much smaller machines than we use. Also, the attack surface is less about the port, and more about the protocol. A Node HTTP interface is going to prioritise being correct as much as possible, because you're coding to the API. Nginx on the other hand will often by default (or at least with configuration) give a much more restricted implementation because it knows that there are bad people out there on the web. To take a totally made up example that may or may not actually be the case, but should make the point... you can upload files in web forms with multipart/form-data - I would expect Node to either not have a limit, or have a very high limit, so that you can set it up how you want. Nginx on the other hand has a default of something like 2MB, which is maybe a bit low for apps that need file upload, but will crucially prevent certain kinds of denial of service attacks. There are many similar areas of attack, abusing edge cases of the HTTP spec that Nginx will handle well out of the box. Not to mention the HTTPS support being probably much more complete in Nginx (in terms of cipher suites and browser compatibility).