- healthz improvements

This commit is contained in:
Josako
2025-09-07 08:28:02 +02:00
parent 5c20e6c1f9
commit 362b2fe753
3 changed files with 16 additions and 2 deletions

View File

@@ -318,6 +318,12 @@ class Config(object):
# Content Directory for static content like the changelog, terms & conditions, privacy statement, ... # Content Directory for static content like the changelog, terms & conditions, privacy statement, ...
CONTENT_DIR = '/app/content' CONTENT_DIR = '/app/content'
# Ensure health check endpoints are exempt from CSRF protection
SECURITY_EXEMPT_URLS = [
r'^/healthz($|/.*)',
r'^/_healthz($|/.*)',
]
class DevConfig(Config): class DevConfig(Config):
DEVELOPMENT = True DEVELOPMENT = True

View File

@@ -86,6 +86,14 @@ def create_app(config_file=None):
# Register Cache Handlers # Register Cache Handlers
register_cache_handlers(app) register_cache_handlers(app)
# Register standard health endpoints at /healthz (liveness/readiness)
# These must be public and not require authentication.
try:
from flask_healthz import healthz as healthz_blueprint
app.register_blueprint(healthz_blueprint, url_prefix="/healthz")
except Exception as e:
app.logger.warning(f"Failed to register /healthz blueprint: {e}")
# Custom url_for function for templates # Custom url_for function for templates
@app.context_processor @app.context_processor
def override_url_for(): def override_url_for():

View File

@@ -62,9 +62,9 @@ spec:
periodSeconds: 10 periodSeconds: 10
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz/ready path: /healthz/live
port: http port: http
initialDelaySeconds: 20 initialDelaySeconds: 25
periodSeconds: 20 periodSeconds: 20
--- ---
apiVersion: v1 apiVersion: v1