首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >nginx proxy_pass请求到fqdn而不转换为IP

nginx proxy_pass请求到fqdn而不转换为IP
EN

Stack Overflow用户
提问于 2022-04-24 23:12:59
回答 1查看 163关注 0票数 0

我正在尝试使用nginx对公共fqdn进行proxy_pass请求。所述服务器具有LB,其配置仅用于在使用fqdn访问时响应请求,并在使用IP访问时获得ssl握手错误。

我的问题是,nginx正在隐式地将fqdn转换为一组IP,然后一个一个地尝试它们,结果失败了。有没有一种不将fqdn转换为IP并将请求路由到fqdn上游的nginx proxy_pass的方法?

代码语言:javascript
复制
        location /public/api {
            proxy_pass https://public.server.com/api;
            proxy_set_header Host $host;
    }
代码语言:javascript
复制
2022/04/24 23:10:20 [error] 912419#912419: *5 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking to upstream, client: xxxxxxxx, server: _, request: "POST /<api> HTTP/1.1", upstream: "https://<ip1>:443/<api>", host: "<ip>"
2022/04/24 23:10:20 [error] 912419#912419: *5 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking to upstream, client: xxxxxxxx, server: _, request: "POST /<api> HTTP/1.1", upstream: "https://<ip2>43/<api>", host: "<ip>"
2022/04/24 23:10:20 [error] 912419#912419: *5 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking to upstream, client: xxxxxxxx, server: _, request: "POST /<api> HTTP/1.1", upstream: "https://<ip3>:443/<api>", host: "<ip>"
EN

回答 1

Stack Overflow用户

发布于 2022-04-25 16:39:45

添加客户端证书和私钥来验证nginx和每个后端服务器。使用proxy_ssl_certificateproxy_ssl_certificate_key指令:

代码语言:javascript
复制
location /public/api {
   proxy_pass https://public.server.com/api;
   proxy_set_header Host $host;
   proxy_ssl_certificate     /etc/nginx/client.pem;  
   proxy_ssl_certificate_key /etc/nginx/client.key  
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71993074

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档