【发布时间】:2020-09-17 14:44:40
【问题描述】:
我正在尝试通过带有 SSL 的子域或通过路由公开 Web 应用程序。
子域方法:
我正在运行的 webapp 在端口:http://localhost:4567/
通过以下配置,网络浏览器告诉我应用程序“不安全”(非 https)。
该应用程序通常运行良好,但不是 https。
我做错了什么? 有其他配置吗?
<IfModule mod_ssl.c>
Listen 443
NameVirtualHost *:443
</IfModule>
<VirtualHost *:80>
ServerName blast.example.com
Redirect permanent / https://blast.example.com/
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin me@gmail.com
ServerName blast.example.com
# ProxyPreserveHost On
ProxyRequests off
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
# ProxyPass / http://localhost:4567/
# ProxyPassReverse / http://localhost:4567/
<Location />
ProxyPass http://localhost:4567/
ProxyPassReverse http://localhost:4567/
</Location>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile ...
SSLCertificateKeyFile ...
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
我一直在遵循How to configure multiple subdomain with SSL in Apache? 给出的处方
路径/路线方法
我还尝试将应用程序公开为路由路径(即https://example.com/blast)
<Location /blast/ >
ProxyPass http://localhost:4567/
ProxyPassReverse http://localhost:4567/
</Location>
但如果我从以下方面开始,反向代理将无法正常工作:
https://example.com/blast
然后单击起始页上的任何内容。 该应用程序会生成一个没有 /blast 部分的内部 URL,从而导致 404:
https://example.com/blah-blah-generated-url
(should be https://example.com/blast/blah-blah-generated-url)
总的来说,子域路径似乎效果更好,除了非https问题。
【问题讨论】:
标签: apache2 subdomain http-proxy