jakarta-ee - 在 web.xml 中始终使用 https 不起作用

标签 jakarta-ee ssl https web.xml deployment-descriptor

我正在尝试在我的网站中始终使用 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>

但是它不起作用。知道我需要做什么吗?

最佳答案

您明确允许 GETPOST使用 <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/

相关文章:

ssl - RavenDB "Connection Was Reset"- 启用 SSL 后

java - OSGi 客户端从 JavaEE 服务器访问 EJB 中的 RMI ClassCastException

security - java.lang.NoClassDefFoundError : sun/security/ssl/SupportedEllipticCurvesExtension

.htaccess - 在 .htaccess 中强制使用 SSL 和 WWW

ssl - DIBS SSL支付

java - 找不到生成的 .keystore 文件

Angular 默认应用服务:Chrome 中的隐私错误:NET::ERR_CERT_AUTHORITY_INVALID

java - createSocket、connect 和 connectionTimeout 的 HTTPS 问题

java - 当我尝试在 Eclipse 中启动服务器时,为什么 Tomcat 'Out of Memory' 是正确的?

java - 如何在 java spring mvc 应用程序中取消以前的操作