Tomcat配置SSL支持https并強制https訪問

image.png

1、在阿里云上支持免費版的CA證書
https://common-buy.aliyun.com/?spm=5176.2020520163.cas.1.4272e7a9R0JOhX&commodityCode=cas#/buy

2、配置Tomcat
https://yundun.console.aliyun.com/?spm=5176.2020520163.1002.d10cas.4272e7a9ZkAjDt&p=cas#/cas/download/214242079920956

3、強制以https方式訪問
在tomcat\conf\web.xml中的</welcome-file-list>后面加上這樣一段:

<login-config>
    <!-- Authorization setting for SSL -->
    <auth-method>CLIENT-CERT</auth-method>
    <realm-name>Client Cert Users-only Area</realm-name>
</login-config>
<security-constraint>
    <!-- Authorization setting for SSL -->
    <web-resource-collection >
    <web-resource-name >SSL</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容