NGINX 转发 http 报错:
SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream
代码内容:
upstream aliyun_server {
server ****.aliyuncs.com;
keepalive 100;
}
location /APIService/file/ {
proxy_set_header Content-disposition "attachment";
proxy_set_header Access-Control-Expose-Headers "*,X-IS-Error-Code,X-IS-Error-Msg,Content-disposition";
proxy_set_header Host "****.aliyuncs.com";
proxy_connect_timeout 5;
proxy_send_timeout 5;
proxy_read_timeout 60;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass https://aliyun_server/;
}
错误原因:http 协议和端口号配置的不对,upstream 中配置 server 默认端口是 80,HTTPS 对应端口应该是443。
修改为:
upstream aliyun_server {
server ****.aliyuncs.com:443;
keepalive 100;
}