javascripthttpnode.jsdelete-method

Response to DELETE method request sent using node.js never arrives


I have node.js server which acts like a proxy. It recieves localhost requests and forward them to web service on another domain. GET, POST and PUT requests work just fine. But I have a problem with DELETE method request. It causing "Gateway Timeout - In read" error. But web service on another domain recieves this request and executes appropriate DB sql to delete requested item. Moreover, if I send the same request using Fiddler for example, I receive an actual response.

Here is how my node.js http.request options look like:

{
  "host": "some.domain",
  "port": 443,
  "path": "/paht/item/id",
  "method": "DELETE",
  "headers": {
    "Host": "some.domain",
    "Content-Type": "application/json; charset=utf-8"
  }
}

Solution

  • Answering to my own question:
    Nodejs adds Transfer-Encoding: chunked header to such DELETE request. And this header was causing described problem.