cahce on /healthcheck
This commit is contained in:
16
app.py
16
app.py
@@ -1565,6 +1565,13 @@ def apply_headers(response):
|
||||
response.headers["Vary"] = "Accept-Encoding"
|
||||
return response
|
||||
|
||||
# --- healthcheck ---
|
||||
if request.path == '/healthcheck':
|
||||
response.headers['Cache-Control'] = 'no-store, no-cache'
|
||||
response.headers.pop('ETag', None)
|
||||
response.headers.pop('Vary', None)
|
||||
return response
|
||||
|
||||
# --- redirecty ---
|
||||
if response.status_code in (301, 302, 303, 307, 308):
|
||||
response.headers["Cache-Control"] = "no-store"
|
||||
@@ -4102,10 +4109,15 @@ def admin_lists_access(list_id=None):
|
||||
def healthcheck():
|
||||
header_token = request.headers.get("X-Internal-Check")
|
||||
correct_token = app.config.get("HEALTHCHECK_TOKEN")
|
||||
|
||||
|
||||
if header_token != correct_token:
|
||||
abort(404)
|
||||
return "OK", 200
|
||||
|
||||
response_data = {
|
||||
"status": "OK",
|
||||
}
|
||||
|
||||
return response_data, 200
|
||||
|
||||
|
||||
@app.route("/admin/settings", methods=["GET", "POST"])
|
||||
|
||||
Reference in New Issue
Block a user