【问题标题】:Grails 3 session timeout not working when deployed to Tomcat部署到 Tomcat 时,Grails 3 会话超时不起作用
【发布时间】:2017-08-30 03:36:58
【问题描述】:

我正在使用 Grails 3.2.3。我已经增加了会话超时,如https://stackoverflow.com/a/30861747/2405040 所述,即在application.yml 中添加以下内容:

server:
   session:
      timeout: 604800 #one week in seconds

这在开发中运行良好,即 session.getMaxInactiveInterval() 返回 604800 但是当我在 Tomcat 上部署 WAR 时(使用 Tomcat 8.5.6),不会反映此会话超时设置,并且该值默认为 1800 秒。

"org.springframework.boot:spring-boot-starter-tomcat"build.gradle 中设置为provided

(我之前正在修改会话超时,正如我在此处描述的 https://stackoverflow.com/a/40382383/2405040 但后来我意识到,这与嵌入式 tomcat 有关,因此切换到上述 application.yml 设置)

我这里有什么遗漏吗?

【问题讨论】:

    标签: spring session tomcat grails grails3.2.0


    【解决方案1】:

    最好的猜测是,您部署到的 Tomcat 容器不使用

    server:
       session:
          timeout: 604800
    

    您设置的值,因为这只是嵌入式 Tomcat 容器的指令。当你部署为war时,你必须配置你部署到的Tomcat服务器:

    https://tomcat.apache.org/tomcat-8.0-doc/config/http.html

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-05
    • 2022-08-22
    • 2016-01-21
    • 2015-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多