Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!