user6564357 user6564357 - 1 year ago 197
HTTP Question

NodeJS Request throw [Error: read ECONNRESET] when make http call

when use Request TCP always REST, but use node native http module is fine.

var request = require('request');
var http = require('http');

request.get('',function(err, res,body){

console.log(err, res); // [Error: read ECONNRESET]


http.get('', function(res) {

console.log(res.statusCode); // 200 all right


how to fixed it ?

Answer Source
        originalHostHeaderName: 'Host'
    function(err, res,body){
        console.log(err, res); 

this site header 'Host' must be Initials.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download