title: How to set up a https foward proxy for curl
body: <p>I am facing one problem, and not get solution on google<p>
  I try to use curl to visit a https website behind a proxy but fail.<p>
  It is success without proxy or visit without ssl. Then I deployed a tcp proxy (got from <a href="https://github.com/kklis/proxy" rel="nofollow noreferrer">https://github.com/kklis/proxy</a>), and set enviroment <code>export https_proxy=127.0.0.1:443</code><p>
  visit <a href="https://www.baidu.com" rel="nofollow noreferrer">https://www.baidu.com</a>, I just got <code>connection aborted</code> error<p>
  Here is how I run proxy:</p>
  
  <p><code>./proxy -l 8111 -h www.baidu.com -p 443</code><p>
  And set proxy environment:<p>
  <code>export https_proxy=127.0.0.1:8111</code><p>
  Run curl:<p>
  <code>curl -v https://www.baidu.com</code> <p>
  Got result:</p>
  
  <blockquote>
    <p>Rebuilt URL to: <a href="https://www.baidu.com/" rel="nofollow noreferrer">https://www.baidu.com/</a> <p>
      Trying 127.0.0.1... <p>
    Connected to 127.0.0.1 (127.0.0.1) port 8111 (#0) <p>
    Establish HTTP proxy tunnel to www.baidu.com:443 <p>
    CONNECT www.baidu.com:443 HTTP/1.1 <p>
    Host: www.baidu.com:443 <p>
    User-Agent: curl/7.47.0 <p>
    Proxy-Connection: Keep-Alive <p>
    Proxy CONNECT aborted <p>
    Connection #0 to host 127.0.0.1 left intact <p>
    curl: (56) Proxy CONNECT aborted <p></p>
  </blockquote>
  
  <p>I tried add --insecure and not work, same result. <p></p>
  
  <p>I think this is the same issue some one has met, still no answer:
  <a href="https://github.com/h2non/balboa/issues/1" rel="nofollow noreferrer">https://github.com/h2non/balboa/issues/1</a></p>
  
  <p>Thanks if anyone can help!</p>