因此,我有一个运行在端口8080上的tomcat服务器和一个运行在端口80和443上的Apache服务器。我可以通过使用这些虚拟服务器将整个网站重定向到https主机:使用ProxyPass将HTTP页面重定向到HTTPS到Tomcat服务器
<VirtualHost *:80>
Redirect permanent/https://localhost
</VirtualHost>
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /etc/httpd/crt/localhost.crt
SSLCertificateKeyFile /etc/httpd/crt/localhost.key
ProxyRequests off
ProxyPreserveHost on
ProxyPass/http://localhost:8080/
ProxyPassReverse/http://localhost:8080/
ProxyPass /catdapp http://localhost:8080/
ProxyPassReverse /catdapp http://localhost:8080/
</VirtualHost>
但是,想获得它,使它只重定向到HTTPS时,网址为localhost/#/login
或localhost/catdapp/#/login
我曾尝试以下:
<VirtualHost *:80>
Redirect permanent /#/login https://localhost/#/login
Redirect permanent /catdapp/#/login https://localhost/#/login
ProxyRequests off
ProxyPreserveHost on
ProxyPass /#/login !
ProxyPass /catdapp/#/login !
ProxyPass/http://localhost:8080/
ProxyPassReverse/http://localhost:8080/
ProxyPass /catdapp http://localhost:8080/
ProxyPassReverse /catdapp http://localhost:8080/
</VirtualHost>
其中没有工作,在控制台显示它检索http://localhost/catdapp/partials/login.html
所以我试图将其更改为这样:
<VirtualHost *:80>
Redirect permanent /catdapp/partials/login.html https://localhost/catdapp/partials/login.html
ProxyRequests off
ProxyPreserveHost on
ProxyPass /catdapp/partials/login.html !
ProxyPass/http://localhost:8080/
ProxyPassReverse/http://localhost:8080/
ProxyPass /catdapp http://localhost:8080/
ProxyPassReverse /catdapp http://localhost:8080/
</VirtualHost>
,然后导致Firefox的控制台输出两个错误:
GET http://localhost/catdapp/partials/login.html 301 Moved Permanently
GET https://localhost/catdapp/partials/login.html 200 OK
的Apache访问日志显示:
"GET /catdapp/partials/login.html HTTP/1.1" 301 328 "http://localhost" "Mozilla/5.0 (X11; Linux x84_64; rv:38.0) Gecko/20100101 Firefox/38.0"
"GET /catdapp/partials/login.html HTTP/1.1" 200 2054 "http://localhost" "Mozilla/5.0 (X11; Linux x84_64; rv:38.0) Gecko/20100101 Firefox/38.0"
任何想法?