首页 > 解决方案 > Apache 和 Nginx(每个都作为反向代理)对自签名后端证书具有非常不同的行为

问题描述

我在我的 UAT 环境中的 Nginx 和 Apache http 服务器(作为反向代理 Web 服务器)上部署 Angular,后端在 Apache Tomcat 上的 spring boot 上(使用 https 为 java REST apis 加密),我注意到 Nginx 被配置为反向代理比 Apache 容易得多,但这主要是因为 Apache 不信任 Java API 证书(因为它是自签名的,所以这似乎是正确的)

有人可以解释为什么会这样吗?我相信 Nginx 是安全的,但我想知道为什么它允许这个自签名证书,而 Apache 默认阻止它(只允许它使用 SSLProxyVerify none)?

Nginx 配置(相关部分):

    location /api {
    proxy_pass  https://192.168.170.78:7002/;
    }

Apache 配置(相关部分):

# SSL proxy config
SSLProxyEngine on

# Why this must be present for the apache to connect to the backend but not for nginx?
SSLProxyCheckPeerName off

# the (proxy) redirection rules for the server
ProxyPass /api/ https://192.168.170.78:7002/
ProxyPassReverse /api/ https://192.168.170.78:7002/

标签: javaapachenginxwebserverreverse-proxy

解决方案


推荐阅读