E
E
Eugenue Cesarevich2021-04-18 18:13:58
Spring
Eugenue Cesarevich, 2021-04-18 18:13:58

Why does a Spring session expire quickly?

I use Spring Session, I store sessions in Redis.

This is how I configured the sessions:

http
                .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED);


Here is the .yaml configuration:
server:
  servlet:
    encoding:
      charset: UTF-8 # Charset of HTTP requests and responses. Added to the "Content-Type" header if not set explicitly
      enabled: true # Enable http encoding support
      force: true
    session:
      timeout: 1m
      cookie:
        max-age: 1m # Using because alone timeout isn't work


I just understand. Authenticated - here's a timeout of 1 minute. If you do nothing, then in a minute the session will be deleted. And if you make some requests to the server, then the timeout is extended. That is, 30 seconds have passed, I made a request, the server saw that I was not sleeping, and the remaining timeout was again raised to a minute.

But in fact, this does not work, the server spits on my requests and throws off the session exactly one minute after authentication. Is this normal behavior? And if this is normal behavior, then how can I do what I want, that is, so that after each request the session is extended?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2021-04-18
@cot_shaurma

Max age, says that max she will live 1 minute

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question