1

I'm using express js 4.0 and the request package to make a request to another application in my network. In my request header, when the 'content-length' is specified, i'm not able to get a response (i get a "ERRTIMEDOUT").

I tried to remove the 'content-length' field by using the compress middleware. However, even that came to no help, even though according to this answer, compress should remove it.

As a hack i set 'Transfer-encoding' : 'Chunked' in my header and I get the response.

Whats the right way to solve this problem? My application configuration is as follows :

var path = require('path');
var favicon = require('static-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var http = require('http');
app.set('port', process.env.PORT || '3000');

app.use(favicon());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

.....

I made the same request with the same code in express js 3 and the content-length header was not being added.

Community
  • 1
  • 1
Arvind Sridharan
  • 3,885
  • 4
  • 29
  • 54

0 Answers0