我已经配置了443端口,现在访问域名会自动重定向到https
但是如果我强制在浏览器的路径上访问HTTP的全路径也是能进入的
如何做到在任何页面下访问HTTP会重定向到HTTPS?
<!-- 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>
并且我已经尝试了通过springMVC的拦截器也没有用
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {
String scheme = request.getScheme();
if ("http".equals(scheme)) {
response.sendRedirect("https://xxx.xxx.xx");
return false;
}
return true;
}