Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
How can I find out whether Node.js HTTPS request error was caused by a missing host or a missing proxy?

I have a script that requests a given URL via a proxy. A failure to connect to the proxy gives an identical error to a failure to connect to the URL over a successful proxy connection.

This code:

var opts = url.parse("https://192.168.0.10/");//this ip address doesn't resolve anywhere
opts.agent = new SocksProxyAgent("socks4://works.local:1080");//this proxy works
    
https.get(opts, function (resp) {

    //successful request is dealt with

}).on("error", function (err) {console.log(err)});

Produces this output:

SocksClientError: Proxy connection timed out
#I cutout the stack trace for brevity
  options: {
    proxy: { host: 'works.local', port: 1080, type: 4 },
    destination: { host: '192.168.0.10', port: 443 },
    command: 'connect',
    timeout: undefined
  }

If I run the same code but instead with a working URL, and a deliberately non-resolving proxy, I get an identical error message.

Is there a convenient way of being more specific about what is broken, whether a failure to connect to the proxy, or a failure to connect to the target URL?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda