【问题标题】:Session timeout in Spring Boot app behind ApacheApache背后的Spring Boot应用程序中的会话超时
【发布时间】:2017-03-16 22:14:35
【问题描述】:

我的应用使用 Spring Boot,我希望用户会话超时为 12 小时。 我将 server.session.timeout=43200 放在我的 application.properties 中,但会话在 12 小时之前仍然过期。

应用程序在 Apache 服务器后面的 Tomcat 7 实例中运行。我需要在容器或服务器中做任何额外的配置吗?

【问题讨论】:

    标签: java apache session tomcat spring-boot


    【解决方案1】:

    这些属性 (server.*) 仅在 SpringBoot 控制 Tomcat(即具有嵌入式 Tomcat 部署为可执行 JAR 的 SpringBoot)时才有效,而不是在将其作为 WAR 部署到现有 Tomcat 实例时有效。

    因此,您需要以“旧”方式之一配置会话超时: 例如

    通过 Tomcat: Default session timeout for Apache Tomcat applications

    通过 Spring Security: Setting session timeout period with Spring Security 3.0

    【讨论】:

    • 谢谢!我将添加一个 request.getSession().setMaxInactiveInterval(43200);进入我的 AuthenticationSuccessHandler。
    猜你喜欢
    • 2015-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-30
    • 1970-01-01
    • 1970-01-01
    • 2013-01-04
    相关资源
    最近更新 更多