Added cache-control response header

This commit is contained in:
Jeremy Karst 2025-01-14 23:55:21 -05:00
parent a661f7cfee
commit 48d9768fd8
2 changed files with 7 additions and 8 deletions

View file

@ -5,7 +5,7 @@ services:
context: . context: .
dockerfile: osg.dockerfile dockerfile: osg.dockerfile
image: osg:28 # <--automate this number change to trigger stack redeploy. image: osg:29 # <--automate this number change to trigger stack redeploy.
environment: environment:
DOCKER: "true" DOCKER: "true"

View file

@ -51,10 +51,6 @@ def run_server(host_ip, host_port, host_prefix, static_dir, database_connection,
'tools.staticdir.on': True, 'tools.staticdir.on': True,
'tools.staticdir.dir': static_dir, 'tools.staticdir.dir': static_dir,
'tools.staticdir.index': 'index.html', 'tools.staticdir.index': 'index.html',
'tools.expires.on': True,
'tools.expires.secs': 30*24*60*60, # 30 days
'tools.gzip.on': True,
'tools.gzip.mime_types': ['text/*', 'application/*', 'font/*'],
}, },
'/images': { '/images': {
'tools.caching.on': True, 'tools.caching.on': True,
@ -69,8 +65,11 @@ def run_server(host_ip, host_port, host_prefix, static_dir, database_connection,
'server.socket_timeout': 10, 'server.socket_timeout': 10,
'response.timeout': 30, 'response.timeout': 30,
'tools.gzip.on': True, 'tools.gzip.on': True,
'tools.gzip.mime_types': ['text/*', 'application/*'], 'tools.gzip.mime_types': ['text/*', 'application/*', 'font/*'],
'tools.encode.text_only': False 'tools.encode.on': True,
'tools.encode.encoding': 'utf-8',
'tools.encode.text_only': False,
'cherrypy.response.headers': {'Cache-Control': f'max-age={30*24*60*60}'}, # 30 days
} }
if production: if production: