1. 開啓https默認端口443
2. 開啓http默認端口80, 這裏的redirectPort設置爲443
3. 配置8009端口重定向爲443
4. 在項目文件web.xml中的</web-app>加入以下配置,強制SSL訪問
<security-constraint>
<web-resource-collection>
<web-resource-name>SSL</web-resource-name>
<url-pattern>/*</url-pattern> 全站使用SSL
</web-resource-collection>
<user-data-constraint>
<description>SSL required</description>
CONFIDENTIAL: 要保證服務器和客戶端之間傳輸的數據不能夠被修改,且不能被第三方查看到
INTEGRAL: 要保證服務器和client之間傳輸的數據不能夠被修改
NONE: 指示容器必須能夠在任一的連接上提供數據。(即用HTTP或HTTPS,由客戶端來決定)
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!-- <security-constraint>
<web-resource-collection>
<web-resource-name>OPENSSL</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint> -->