You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTP connection prematurely closed when unescaped space present in query string #13407
Using this bug it is possible to craft a denial of service attack when running Node behind an NGINX reverse proxy. NGINX treats the closed connection as though the server has gone offline. When requests crafted in this way are sent in rapid succession, NGINX may start returning HTTP 504 to all callers because there are "no live upstreams" left to service the request.
The preferred behavior, in my opinion, would be to return an HTTP 400 instead of closing the connection. This seems to be the prevailing treatment on the interwebs.
Node.js won't do it for you but you can send a 400 response if you listen for the 'clientError' event on the server instance. There is an example in the documentation.
We're currently discussing whether to change the default behavior from 'close connection' to 'send 400 response and close connection'. This issue can stay open until that discussion is resolved.
Activity
alexkwolfe commentedon Jun 2, 2017
Using this bug it is possible to craft a denial of service attack when running Node behind an NGINX reverse proxy. NGINX treats the closed connection as though the server has gone offline. When requests crafted in this way are sent in rapid succession, NGINX may start returning HTTP 504 to all callers because there are "no live upstreams" left to service the request.
The preferred behavior, in my opinion, would be to return an HTTP 400 instead of closing the connection. This seems to be the prevailing treatment on the interwebs.
bnoordhuis commentedon Jun 2, 2017
Node.js won't do it for you but you can send a 400 response if you listen for the 'clientError' event on the server instance. There is an example in the documentation.
alexkwolfe commentedon Jun 2, 2017
Oh nice! Thanks!
alexkwolfe commentedon Jun 2, 2017
Is this is the correct way to handle this case? Or is it worth leaving this issue open?
bnoordhuis commentedon Jun 3, 2017
We're currently discussing whether to change the default behavior from 'close connection' to 'send 400 response and close connection'. This issue can stay open until that discussion is resolved.
apapirovski commentedon Apr 12, 2018
This was resolved in #15324