C
C
client242016-03-15 19:28:04
Node.js
client24, 2016-03-15 19:28:04

Error "tunneling socket could not be established", how to do it right??

making a request

const req = require('request');

var options = {
  url: 'https://vk.com/',
  proxy: 'https://login:[email protected]:YYYY/',
  method: 'POST',
  headers: headers,
};
var headers = {
  'User-Agent': 'Node js'
};

function callback(error, response, body) {
  console.log(error);
  if (response !== undefined)
    console.log(response.statusCode);
}

req(options, callback);

and i get an error

{ [Error: tunneling socket could not be established, cause=write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:] code: 'ECONNRESET' }

how to fix or do it right??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Markus Kelvin, 2016-03-15
@client24

try changing options to the following. strictSSL false is added, and just http together with https is written in the proxy.
Also an additional question, are you making the request directly or are you on some sort of corporate network or behind a proxy server?

var options = {
      url: 'https://vk.com',
      proxy: 'http://login:[email protected]:YYYY',
      method: 'POST',
      headers: headers,
      strictSSL: false
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question