web-services - Nginx SSL 直通不适用于 REST Web 服务

标签 web-services ssl nginx load-balancing nginx-reverse-proxy

我正在尝试使用 Nginx 在 3 个启用 SSL 的 REST 网络服务实例上进行负载平衡。

在我的案例中,我需要使用 SSL pass-thru。

我关注了https://www.cyberciti.biz/faq/configure-nginx-ssltls-passthru-with-tcp-load-balancing/

https://serversforhackers.com/c/tcp-load-balancing-with-nginx-ssl-pass-thru

但我没有在访问负载均衡器端点时获得默认 json。

对于所有类型的请求,我都得到如图所示的输出。

enter image description here

请帮助我。

最佳答案

在关注 https://www.cyberciti.biz/faq/configure-nginx-ssltls-passthru-with-tcp-load-balancing/ 时我找到 proxy_ssl on; 丢失。下面的流配置工作得很好,我们需要通过 http 而不是 https 协议(protocol)访问 Nginx 服务器,但使用的端口是 8443。我需要弄清楚为什么它在 上不起作用https 协议(protocol)。

stream {
    upstream apiservers {
        192.168.1.2:8443 max_fails=3 fail_timeout=10s;
        192.168.1.3:8443 max_fails=3 fail_timeout=10s;
        192.168.1.4:8443 max_fails=3 fail_timeout=10s;
    }

    server {
        listen 8443;
        proxy_ssl  on;
        proxy_pass apiservers;
        proxy_next_upstream on;
    }
}

关于web-services - Nginx SSL 直通不适用于 REST Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46764007/

相关文章:

java - 斯坦福解析器在Web服务中的使用

cordova - 安全套接字层 SDK

node.js - 无法使用 nginx 在快速服务器之上配置 SSL

java - Websphere Liberty- java.lang.NoClassDefFoundError : com. ibm.websphere.ssl.SSLException

python - 当发送给它的查询太长时,uWSGI 似乎会中断

web-services - Spring-WS与JAX-WS

c# - 为 Web 服务创建 XML 字符串

java - Android 应用程序在使用 okhttp 发送 http post 时崩溃

wordpress - 在 Azure VMSS 上使用 Cloud Init 部署 WordPress 时收到 502 错误网关

javascript - 为什么使用 nginx 作为 websocket 代理?