大概情况:前端项目是vue,部署到nginx,由于项目中使用了第三方接口,直接访问会存在跨域问题,所以使用nginx进行转发,但是请求的时候报错了。
错误日志
SSL_do_handshake() failed (SSL: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:SSL alert number 40) while SSL handshaking to upstream, client: 127.0.0.1, server: 127.0.0.1, request: "POST /api/test HTTP/1.1", upstream: "https://xxxx", host: "127.0.0.1", referrer: "http://127.0.0.1/"
no live upstreams while connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request: "POST /api/test HTTP/1.1", upstream: "https://xxxx", host: "127.0.0.1", referrer: "http://127.0.0.1/"
nginx配置
location /api/ {
proxy_pass https://xxx.com/;
}
修改后配置
location /api/ {
proxy_pass https://xxx.com/;
proxy_ssl_server_name on;
proxy_ssl_session_reuse off;
}
以上两条指令是通过查看官方文档 得知,有兴趣的可以自己去查询原理