Added cache-control response header
This commit is contained in:
parent
a661f7cfee
commit
48d9768fd8
2 changed files with 7 additions and 8 deletions
|
@ -5,7 +5,7 @@ services:
|
|||
context: .
|
||||
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:
|
||||
DOCKER: "true"
|
||||
|
|
13
server.py
13
server.py
|
@ -50,11 +50,7 @@ def run_server(host_ip, host_port, host_prefix, static_dir, database_connection,
|
|||
'/': {
|
||||
'tools.staticdir.on': True,
|
||||
'tools.staticdir.dir': static_dir,
|
||||
'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/*'],
|
||||
'tools.staticdir.index': 'index.html',
|
||||
},
|
||||
'/images': {
|
||||
'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,
|
||||
'response.timeout': 30,
|
||||
'tools.gzip.on': True,
|
||||
'tools.gzip.mime_types': ['text/*', 'application/*'],
|
||||
'tools.encode.text_only': False
|
||||
'tools.gzip.mime_types': ['text/*', 'application/*', 'font/*'],
|
||||
'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:
|
||||
|
|
Loading…
Add table
Reference in a new issue