Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

HTTPS request not working with proxy #2474

@chowey

Description

@chowey

I have a squid proxy on my local computer (127.0.0.1:3128). It is configured to require no authentication. If I try to use an https.request, I get an error like:

{ [Error: socket hang up] code: 'ECONNRESET' }

The following code reproduces this issue (provided of course that you have a squid proxy set up on port 3128):

var https = require('https');

var options = {
  hostname: '127.0.0.1',
  port: 3128,
  path: 'https://github.com/',
  headers: {
    Host: 'github.com',
    'User-Agent': 'Node.js/0.6.6'
  },
  method: 'GET'
};

var req = https.request(options, function (res) {
  console.log('statusCode: ', res.statusCode);
  console.log('headers: ', res.headers);

  res.on('data', function (chunk) {
    process.stdout.write(chunk);
  });
}).on('error', function (e) {
  console.error(e);
}).end();

It is definitely an error with node itself. If the problem were with squid, it would just result in responses with statusCode 501.

I am running v0.6.6 on Windows 7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions