Nginx upstream to https host - ssl3_get_record:wrong version number

对着背影说爱祢 提交于 2020-01-24 10:46:08

问题


I am trying to proxy requests to a remote server, this is how I configure my Nginx

upstream myupstream {
  server remote-hostname;
}

...

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 <remote-hostname-here>;
    # proxy_set_header X_FORWARDED_PROTO https;
}

As a result I see error 502 page and this record in error.log

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: <my-web-host-here>, 
request: "GET /v1/some/page HTTP/1.1", 
upstream: "https://<my-web-host-ip-here>:80/v1/some/page", 
host: "<my-web-host-here>"

What could cause this?

Note: This nginx proxy is on my local machine.


回答1:


upstream: "https://<my-web-host-ip-here>:80/v1/some/page", 

It is not really clear to me what you are trying to achieve. But it is very unlikely that you have a HTTPS server on port 80. Port 80 is commonly used by HTTP not HTTPS. Trying to access it by HTTPS will usually result in a HTTP error response by the server which, when interpreted as the expected TLS handshake response, will result in strange error messages like ssl3_get_record:wrong version number.



来源:https://stackoverflow.com/questions/53245818/nginx-upstream-to-https-host-ssl3-get-recordwrong-version-number

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!