【问题标题】:cookie config issue when switching between https and http在 https 和 http 之间切换时的 cookie 配置问题
【发布时间】:2019-05-01 09:16:15
【问题描述】:

我正在使用具有 Servlet 3.1 的 Jetty 9.2.25。我的 web.xml 中有以下 cookie 配置

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

当我将此安全标志设置为 true 时,它​​正在工作。但是当我将其设置为假如上所示并访问 https 站点时,安全标志被修改为 true,我无法访问 http 站点。我不明白这是怎么回事? 这是默认行为吗? 我尝试查看 Servlet 发行说明,但没有这样的更新。

对这种行为有任何想法吗?

访问 https 时如何将安全设置为假?

提前致谢。

【问题讨论】:

    标签: servlets cookies jetty session-cookies web.xml


    【解决方案1】:

    Jetty 9.2.x is EOL (End of Life).

    在 Jetty 9.4.x(当前受支持/稳定的 Jetty 版本)中,您可以将 SessionHandler 配置为默认不启用安全请求以实现您想要的行为。

    SessionHandler.setSecureRequestOnly(false);
    

    注意:此功能在 Jetty 9.2.x 中不可用

    【讨论】:

      猜你喜欢
      • 2019-01-14
      • 2014-01-30
      • 1970-01-01
      • 2011-08-16
      • 2014-01-11
      • 1970-01-01
      • 2011-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多