Whenever i do an operation like save, update or filter something on my django admin, there's a chance of get redirect to login page and it's required to loging again. This behaviour occurs very often, but the odd thing is: it only occur's on production enviorment. I'm running the aplication on an ECS cluster with AWS fargate. When i check the browser storage, there are 3 cookies: csrftoken, sessionid and djdt. all of them with a large expiration time ( at least one week ).
My settings.py has the following session configuration:
SESSION_CACHE_ALIAS = 'sessions'
# The module to store session data
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
# A string like "example.com", or None for standard domain cookie.
SESSION_COOKIE_DOMAIN = env.str('SESSION_COOKIE_DOMAIN', default=None)
# Whether the session cookie should be secure (https:// only).
SESSION_COOKIE_SECURE = not DEBUG
# why it doesn't resolve the sundenly logout problem!?
SESSION_COOKIE_AGE= 24*60*60*7
I tried the following issues, but they doesn't work for me:
any help will be apreciated
EDIT I figured out some important clue:
before i get redirect, the following error raise on browser's console:
Refused to execute script from '<my_url>/jsl18n' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled
after the error message get displayed, any click or interaction with the admin result in a redirect to login's page. i use some very simple JS files on admin to hide/show some fields based on user interaction. I think this massage has some relationship with theses static js files. I found some issues with this exact error message, and it's look like not django specific. But the issues didn't help me at all.