我正在尝试在我的网站中始终使用 https。我的 web.xml 文件中有以下内容:
<security-constraint>
<display-name>All access - GET and POST over SSL</display-name>
<web-resource-collection>
<web-resource-name>Common area - GET and POST</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method-omission>GET</http-method-omission>
<http-method-omission>POST</http-method-omission>
</web-resource-collection>
<user-data-constraint>
<description/>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
但是它不起作用。知道我需要做什么吗?
最佳答案
您明确允许 GET
和 POST
使用 <http-method-omission>
在 http 中访问您的网站的方法标签。
我想你的意思是:
<http-method>GET</http-method>
<http-method>POST</http-method>
但是最好省略任何 HTTP 方法的声明,因为您肯定想为所有这些方法强制使用 https。
关于jakarta-ee - 在 web.xml 中始终使用 https 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36956895/