axios: Error when trying to connect to HTTPS site through proxy

I get this error when connecting to an HTTPS site through a proxy. It works fine when I connect to that same site using HTTP (the site is available in both HTTP and HTTPS). To test it you can try with any HTTPS proxies (test ones available at https://free-proxy-list.net/, I’ve tried only the ones with a ‘Yes’ in the ‘Https’ column.)

(node:11581) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): 
Error: write EPROTO 140378207070016:error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794:

The code

async function download() {
  const response = await axios('https://api.ipify.org', {
    timeout: 5000,
    proxy: {
      host: '104.154.142.106',
      port: 3128
    }
  })
  console.log(response.headers)
}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 19 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@futurmat not only did I give up on axios for this purpose, but I also gave up on Javascript. I was able to get request-promise to work, but then I noticed performance and memory issues with it. Since then I’ve switched over to Python using Tornado for networking - and things are running along much more smoothly. Python is really so much easier work with than Javascript.

+1

is this issue ever going to be addressed? or is it out of sight out of mind???

if i use curl i can fetch it fine. if i use axios I get a 503 not sure url i’m querying is https

Had a very similar issue using axios 0.18.0 in different node versions: 8.5, 8.6, 9.7.1, 10.8.0. Using request-promise as suggested above fixed my issue.

There’s many providers. Search for “paid proxies” there are premium proxies (that are yours and yours alone) and there are “shared proxies” which you pay for (much more reliable than scraping free lists) but others use as well. Typically it ranges from .50 cents - $1 USD per proxy depending on who you buy from.

Free proxy lists are no good. Get a paid proxy.

The options are passed on to request{ proxy: 'http://user:pass@x.x.x.x:8080' }

Same here,

curl -x 144.217.207.164:3128 -L ‘https://www.walmart.com/ip/22790128

This works totally fine!

But this will fail:

 var config = {
   proxy: { host: '144.217.207.164', port: 3128 }
 }

 axios.get('https://www.walmart.com/ip/22790128', config).
.then(result => {
       // I want to be here
 })
.catch(error => { 
       // But I'm stuck here!!!
}

From what I’ve seen, axios doesn’t support https over proxy (even if the proxy supports HTTPS). But it may actually be a node.js configuration thing (not an axios issue). If someone can fill in the blanks please do!