Skip to content

Commit

Permalink
Enabled memcached session backend and clear cache when service config…
Browse files Browse the repository at this point in the history
… changes

The keystone endpoint is cached and may not be valid across config changes.
Toggling keystone TLS in particular will change the keystone url and break
any existing horizon session.

This switches from cookie session backend to memcached backend and uses the
CONFIG_HASH as the cache prefix to ensure caches are invalidated if/when the
config changes.

Jira: OSPRH-4392
  • Loading branch information
olliewalsh authored and bshephar committed Mar 12, 2024
1 parent 42d18b3 commit 04c74ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion templates/horizon/config/local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'LOCATION': [ {{.memcachedServers}} ]
'LOCATION': [ {{.memcachedServers}} ],
# To drop the cached sessions when config changes
'KEY_PREFIX': os.environ['CONFIG_HASH']
},
}

# If you use ``tox -e runserver`` for developments,then configure
# SESSION_ENGINE to django.contrib.sessions.backends.signed_cookies
# as shown below:
#SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'


# Send email to the console by default
Expand Down

0 comments on commit 04c74ac

Please sign in to comment.