forked from rDrama/rDrama
1
0
Fork 0

improve(?) caching - vary header should not contain "cookie" for assets

master
atrc445 2021-08-13 11:13:18 +02:00
parent 3d7dd7b0c3
commit c8784d64f4
1 changed files with 5 additions and 4 deletions

View File

@ -37,6 +37,7 @@ app.config['DATABASE_URL'] = environ.get("DATABASE_CONNECTION_POOL_URL",environ.
app.config['SECRET_KEY'] = environ.get('MASTER_KEY')
app.config["SERVER_NAME"] = environ.get("DOMAIN").strip()
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 60*10
app.config["SESSION_COOKIE_NAME"] = "session_" + environ.get("SITE_NAME").strip().lower()
app.config["VERSION"] = "1.0.0"
@ -213,6 +214,9 @@ def before_request():
g.timestamp = int(time.time())
#do not access session for static files
if request.path.startswith("/assets"): return
session.permanent = True
ua_banned, response_tuple = get_useragent_ban_response(
@ -254,13 +258,10 @@ def after_request(response):
print(e)
abort(500)
response.headers.remove("Cache-Control")
response.headers.add("Cache-Control", "public, max-age=600")
return response
@app.route("/<path:path>", subdomain="www")
def www_redirect(path):
return redirect(f"https://{app.config['SERVER_NAME']}/{path}")
return redirect(f"https://{app.config['SERVER_NAME']}/{path}")