Shashank Agrawal
Shashank Agrawal

Reputation: 25797

Grails 3 session timeout not working when deployed to Tomcat

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?

Upvotes: 0

Views: 1756

Answers (1)

sbglasius
sbglasius

Reputation: 3124

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

Upvotes: 2

Related Questions