1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 如何实现用户用访问http时自动跳转到https的访问地址? – 网络

如何实现用户用访问http时自动跳转到https的访问地址? – 网络

时间:2023-09-26 04:21:36

相关推荐

如何实现用户用访问http时自动跳转到https的访问地址? – 网络

Tomcat配置如下:

1.server.xml设置:

<Connectorport=”80″protocol=”HTTP/1.1″connectionTimeout=”20000″redirectPort=”443″/>

2.web.xml设置

<!–添加到web.xml最后面–>

<security-constraint>

<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>

3.重启Tomcat测试

http://localhost自动跳转https://localhost.

让技术之花,在头条盛开……

也可以直接查看到偶的头条文章:Tomcat设置http自动跳转https

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。