title: Nginx upstream to https host - ssl3_get_record:wrong version number
body: <p>I am trying to proxy requests to a remote server, this is how I configure my Nginx</p>
  
  <pre><code>upstream myupstream {
    server remote-hostname;
  }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>location ~ ^/(v1|v2|v3)/.*$ {
  
      proxy_pass https://myupstream;
  
      # also tried these options:
      # proxy_ssl_server_name on;
      # proxy_ssl_verify off;
      # proxy_set_header Host &lt;remote-hostname-here&gt;;
      # proxy_set_header X_FORWARDED_PROTO https;
  }
  </code></pre>
  
  <p>As a result I see error 502 page and this record in error.log</p>
  
  <pre><code>2018/11/10 19:41:38 [error] 8410#8410: *1 SSL_do_handshake() failed 
  (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) 
  while SSL handshaking to upstream, client: 127.0.0.1, server: &lt;my-web-host-here&gt;, 
  request: "GET /v1/some/page HTTP/1.1", 
  upstream: "https://&lt;my-web-host-ip-here&gt;:80/v1/some/page", 
  host: "&lt;my-web-host-here&gt;"
  </code></pre>
  
  <p>What could cause this?</p>
  
  <p>Note: This nginx proxy is on my local machine.</p>