Grails 3 session timeout not working when deployed to Tomcat

妖精的绣舞 提交于 2019-12-12 04:22:51

问题


I'm using Grails 3.2.3. I've increased the session timeout as described here https://stackoverflow.com/a/30861747/2405040 i.e. adding the following in application.yml:

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

This is working fine while in development i.e. session.getMaxInactiveInterval() returns 604800 but when I'm deploying the WAR on a Tomcat (using Tomcat 8.5.6), this session timeout setting is not reflected and the value is default to 1800 seconds.

"org.springframework.boot:spring-boot-starter-tomcat" is set to provided in build.gradle.

(I was previously modifying the session timeout as I described here https://stackoverflow.com/a/40382383/2405040 but later I realized that, that is related to embedded tomcat so switched to above application.yml setting)

Am I missing anything here?


回答1:


A best guess would be, that the Tomcat container you deploy to does not use the

server:
   session:
      timeout: 604800

value you set, as this is only a directive to the embedded Tomcat container. When you deploy as war, you have to configure the Tomcat server you deploy to:

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



来源:https://stackoverflow.com/questions/43215649/grails-3-session-timeout-not-working-when-deployed-to-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!