cahce on /healthcheck

This commit is contained in:
Mateusz Gruszczyński
2025-12-24 22:38:15 +01:00
parent bc6dcc5bb7
commit 9537eef58d

16
app.py
View File

@@ -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"])