如何在 Wildfly 中激活安全 cookie?

How to activate secure cookies in Wildfly?

我正在尝试为 Wildfly(版本 8.2)中的网络应用程序将安全标志添加到我的 cookie 中。在 the documentation page of the servlet container settings 中,您会发现“servlet-container”的子项是:

  1. jsp
  2. 持久会话
  3. 会话 cookie
  4. websockets

但是我只有 jspwebsockets。如何访问会话 cookie 设置?如果不能,如何将安全标志添加到我的 cookie 中?

更新:我无法访问战争中的web.xml文件,只能访问wildfly配置文件。

通过将以下内容添加到您的 web.xml.

    <session-config>
      <cookie-config>
        <http-only>true</http-only>
        <secure>true</secure>
      </cookie-config>
    </session-config>

通过 jboss-cli 尝试执行以下命令:

/subsystem=undertow/servlet-container=default/setting=session-cookie:add(http-only=true,secure=true)

或在您的 standalone.xml:

<servlet-container name="default">
    <session-cookie http-only="true" secure="true"/>
    <jsp-config/>
</servlet-container>

参考:http://wildscribe.github.io/Wildfly/8.2.0.Final/subsystem/undertow/servlet-container/setting/session-cookie/index.html