我在我的web應用程序中配置了SSL。根據所需的步驟,我已將證書安裝在Tomcat中。在Apache Tomcat中執行301從http重定向到https
,我已被以下的教程是 https://www.mulesoft.com/tcat/tomcat-security
我已經強迫通過http使用https這意味着爲http的任何請求將被轉發到https。我改變了我的server.xml中的以下變化
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443"
proxyHost="10.1.1.1" proxyPort="80"
URIEncoding="UTF-8"
maxHttpHeaderSize="32768"/>
是web.xml中的變化如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>SecureConnection</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
然而,重定向這是發生的臨時重新指導,即302. 我想使用301重定向即永久重定向。
我該如何做到這一點?
你是否找到了這個問題的答案?我也有同樣的問題。 – Thermometer
同樣在這裏,在這個問題上的任何進展? – Default71721
對於Google員工現在只想「強制執行https tomcat」,「始終https tomcat」或類似的情況,這就是解決方案。 https://jelastic.zendesk.com/hc/en-us/community/posts/206121996-HTTP-HTTPS-redirection-into-the-Tomcat也提供了一個解決方案。 – koppor