DELETE request issued to nginx back-end fails with 411 #338

wants to merge 4 commits into


None yet

5 participants


Interesting. I'll accept it, but please fix coding style:

if (req.method === 'DELETE') {
  req.headers['content-length'] = '0';

and make sure that indentation matches rest of the code. Thanks!

nodejitsu member

Reluctantly +1


In my case, as an observation, nginx is stripping the header's 'content-length'. When I run locally 'content-length' exists on the req and when I run remotely heroku 'content-length' is stripped from the req. The easy fix for me was to just add it back to the req before passing to node-http-proxy.


Similar problem for CORS features. When the browser makes the preflight requestI get a 411 error. As far as the preflight is automatically made from the browser there is no way to set content-length to 0 and CORS will never work with node http proxy.


Actually, now that I think about it, a DELETE request can have a body. We happen to use such requests ourselves in production.
We should check if a Content-Length is already defined, I think.
@indexzero @ian7 opinions?


That is true. I check is needed. I would add also OPTIONS (for CORS preflight) on the list of verbs to check.

@indexzero indexzero added a commit that closed this pull request Mar 9, 2013
@indexzero indexzero [fix] Set "content-length" header to "0" if it is not already set on …
…DELETE requests. Fixes #338.
@indexzero indexzero closed this in 9be0af3 Mar 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment