【发布时间】:2020-09-03 10:20:22
【问题描述】:
我有一个设置了 SSL 处理的 Spring Boot 应用程序。我正在使用 iptables 重新路由将所有端口 80 流量路由到 Spring Boot 端口 8080,并将所有 443 流量路由到 Spring Boot 8443。
Spring Boot 然后将任何 http 流量重定向到 https (443)。一切正常。
现在我想运行一个 Apache2 服务器并使用它将流量重定向到 Spring Boot,而不是直接使用 iptables 重新路由。
我已经为该站点创建了以下 conf 文件:
<VirtualHost *:80>
ServerAdmin mail@gmail.com
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ErrorLog ${APACHE_LOG_DIR}/site/error.log
CustomLog ${APACHE_LOG_DIR}/site/access.log combined
</VirtualHost>
<VirtualHost _default_:443>
ServerAdmin mail@gmail.com
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / https://localhost:8443/
ProxyPassReverse / https://localhost:8443/
ErrorLog ${APACHE_LOG_DIR}/site/error.log
CustomLog ${APACHE_LOG_DIR}/site/access.log combined
</VirtualHost>
但它似乎不起作用。我收到“此站点无法提供安全连接”。尽管从 http 到 https 的重定向(在 spring boot 中设置)似乎确实有效。
我在 google 上找到的大部分内容都展示了如何在 Apache2 后面配置 Spring Boot,并由 Apache2 处理 ssl。我如何设置它以便它是处理 ssl 的 spring boot,而 Apache 基本上只是做端口映射。或者设置 Apache 来处理 ssl 会不会那么痛苦?
【问题讨论】:
标签: apache spring-boot ssl https proxy