From 469f901289fc3a46adeaef8ef3d84b9bb9c51a94 Mon Sep 17 00:00:00 2001 From: Sascha Goebel Date: Fri, 6 Nov 2015 09:36:19 +0100 Subject: [PATCH] Always send Content-Length header. Fixes compatibility issues with elasticsearch behind nginx. See https://github.com/elastic/cookbook-elasticsearch/issues/38 or http://serverfault.com/questions/164220/is-there-a-way-to-avoid-nginx-411-content-length-required-errors --- src/lib/connectors/http.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/connectors/http.js b/src/lib/connectors/http.js index fcaf91f3c..7d972a1cd 100644 --- a/src/lib/connectors/http.js +++ b/src/lib/connectors/http.js @@ -185,10 +185,11 @@ HttpConnector.prototype.request = function (params, cb) { request.setHeader('Content-Length', Buffer.byteLength(params.body, 'utf8')); request.end(params.body); } else { + request.setHeader('Content-Length', 0); request.end(); } return function () { request.abort(); }; -}; \ No newline at end of file +};