title: https request via https proxy but return 'unknown protocol:openssl ' error
body: <p>Everything is fine if I request 'HTTP' address via  'HTTP' proxy</p>
  
  <pre><code>    const rq = require('request-promise'); 
      try {
      let res = rq({
          url: 'http://xxxx',
          timeout: TIME_OUT,
          gzip: true,
          proxy: 'http://112.25.60.32:8080'
      });
      res.then(res =&gt; {
          console.log('res');
          console.log(res);
      }).catch(err =&gt; {
          console.log(err);
      });
  } catch (error) {
      console.log(error);
  }
  </code></pre>
  
  <p>But if request 'https' addrss via 'https' proxy, it will return 'unknown protocol '</p>
  
  <blockquote>
    <p>RequestError: 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:827:</p>
  </blockquote>
  
  <pre><code>try {
      let res = rq({
          url: 'https://ipinfo.io/', //  https address
          timeout: TIME_OUT,
          gzip: true,
          rejectUnauthorized: false,
          proxy: 'https://149.56.109.24:3128' //  https proxy
      });
      res.then(res =&gt; {
          console.log('res');
          console.log(res);
      }).catch(err =&gt; {
          console.log(err);
      });
  } catch (error) {
      console.log(error);
  }
  </code></pre>
  
  <p>At first I thought it was a problem with the proxy address. But the same proxy address works fine in python requests module</p>
  
  <blockquote>
    <p>python code</p>
  </blockquote>
  
  <pre><code>import requests, os
  os.environ['HTTP_PROXY'] = '112.25.60.32:8080'
  os.environ['HTTPS_PROXY'] = '149.56.109.24:3128'
  try:
      text = requests.get('https://ipinfo.io/').text # request https address
  except Exception as e:
      print(e)
      print('connect failed')
  print(text) 
  # it works fine!  {
    "ip": "149.56.109.24:3128", 
    "hostname": "181.ip-158-69-206.net",
    "city": "Montreal",
    "region": "Quebec",
    "country": "CA",
    "loc": "45.5000,-73.5833",
    "postal": "H3A",
    "org": "AS16276 OVH SAS"
  }
  # The returned 'ip' information is the 'https' proxy address.
  </code></pre>
  
  <p>A similar problem was found in StackOverflow. Someone replied that it is a port problem.</p>
  
  <blockquote>
    <p>Here is the link <a href="https://stackoverflow.com/questions/15421050/node-request-getting-error-ssl23-get-server-hellounknown-protocol">StackOverflow</a></p>
  </blockquote>
  
  <p><strong>But I think this is not a problem about the port,because when I use proxy by fiddler, it works!</strong></p>
  
  <blockquote>
    <p>Here is my configuration about fiddler</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/P3lvD.png" alt="enter image description here"></p>
  
  <blockquote>
    <p>code (by fiddler)</p>
  </blockquote>
  
  <pre><code>try {
    let res = rq({
      url: 'https://ipinfo.io/',
      timeout: TIME_OUT,
      gzip: true,
      rejectUnauthorized: false,
      proxy: 'http://127.0.0.1:8888' // through fiddler
    });
    res
      .then(res =&gt; {
        console.log('res');
        console.log(res); // it works!!
      })
      .catch(err =&gt; {
        console.log(err);
      });
  } catch (error) {
    console.log(error); 
  }
  </code></pre>
  
  <p>However, based on the above code, Proxy changed to '149.56.109.24:3128' (without fiddler) will still report '<strong>unknown protocol:openssl\ssl\s23_clnt.c:827</strong>' error</p>
  
  <p>So what went wrong? I have not solved it.</p>