nginx - SSL_do_handshake() 在 cloudflare 后面使用 nginx-proxy 失败
问题描述
我现在在这个问题上挣扎了 2-3 天。我的问题是:从一个反向代理到另一个反向代理执行 proxy_pass 时出现“SSL_do_handshake() failed”。
我有一个看起来像这样的设置:
gcp VM 1 containers :
- nginx reverse proxy 1
- acme companion for ssl
- frontend website (local nginx)
gcp VM 2 containers :
- nginx reverse proxy 2
- acme companion for ssl
- backend nodejs
DNS server is done by cloudflare :
- frontend.website.com : "gcp VM 1" IP adress
- backend.nodejs.com : "gcp VM 2" IP adress
为避免 CORS 错误,“frontend.website.com”向“frontend.website.com/api”发出请求。“nginx 反向代理 1”具有此配置以重定向到后端:
location /api {
proxy_pass https://backend.nodejs.com/api;
}
我在“nginx 反向代理 1”日志中得到的错误:
nginx.1 | 2021/10/22 11:10:53 [error] 283#283: *11287 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: 2a01:e0a:4d0:4960:dc2e:8d3a:ba04:10a2, server: frontend.website.com, request: "POST /api HTTP/2.0", upstream: "https://172.67.155.25:443/api", host: "frontend.website.com", referrer: "https://frontend.website.com/"
nginx.1 | 2021/10/22 11:10:53 [warn] 283#283: *11287 upstream server temporarily disabled while SSL handshaking to upstream, client: 2a01:e0a:4d0:4960:dc2e:8d3a:ba04:10a2, server: frontend.website.com, request: "POST /api HTTP/2.0", upstream: "https://172.67.155.25:443/api", host: "frontend.website.com", referrer: "https://frontend.website.com/"
nginx.1 | 2021/10/22 11:10:53 [error] 283#283: *11287 no live upstreams while connecting to upstream, client: 2a01:e0a:4d0:4960:dc2e:8d3a:ba04:10a2, server: frontend.website.com, request: "POST /api HTTP/2.0", upstream: "https://backend.nodejs.com/api", host: "frontend.website.com", referrer: "https://frontend.website.com/"
注意:错误日志 172.67.155.25:443 中的 IP 不是 gcp VM 1 或 2 IP,我假设它是 Cloudflare IP?
我已经尝试过的事情:
- 检查 SSL 证书,双方都可以。
- proxy_pass 到 http 而不是 https,它会引发其他问题。
- 我已经尝试过 proxy_ssl_server_name ;(取自这里)。Cloudflare 返回了 403 禁止:
DNS points to prohibited IP
What happened?
You've requested a page on a website (frontend.website.com) that is on the Cloudflare network. Unfortunately, it is resolving to an IP address that is creating a conflict within Cloudflare's system.
What can I do?
If you are the owner of this website:
you should login to Cloudflare and change the DNS A records for frontend.website.com to resolve to a different IP address.
问题是 frontend.website.com 的 DNS A 记录很好(其他应用程序使用它没有问题)
我觉得应该与“backend.nodejs.com/api”进行ssl握手,但根据错误日志,它尝试改为对cloudflare IP地址进行握手(此处为172.67.155.25:443,但每次都不同)
我在这里错过了什么吗?可能是什么问题?
如果您需要任何其他信息,请随时提出要求。
解决方案
推荐阅读
- arrays - 如何使用 didSelectRow 为多个 UIPickerView 使用数据
- c - C、动态数组、分段错误
- c++ - 如何使用通过指针传递给函数的数组中的对象的函数成员?
- sql-server - 我可以在 SQL 中提取 Max 和 Min 值而不使用 group by 非聚合值吗?
- listview - 如何将项目选择的数据绑定到 xamarin 表单中的按钮命令
- visual-studio-2019 - VS2019调试停止时保持IIS express运行
- php - laravel spatie 权限中的多个警卫分配滚动问题
- serialization - 静态资产的 Lagom 序列化
- react-vis - React Vis - 有没有办法在当前鼠标位置获取 Y 的值?
- php - laravel如何读取和编辑word文件?