0

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?

Community
  • 1
  • 1
Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121

1 Answers1

2

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

sbglasius
  • 3,104
  • 20
  • 28
  • Yeah, I think so too! But is there a way we can increase the timeout from within the app like Grails 2? – Shashank Agrawal Apr 06 '17 at 11:18
  • 1
    Perhaps this blog entry can be of help: http://fruzenshtein.com/spring-java-configuration-session-timeout. I got that link from this SO: http://stackoverflow.com/questions/28103852/spring-boot-session-timeout – sbglasius Apr 06 '17 at 11:24