Configuring Flask Application for Airflow Webserver¶
FabAuthManager
and Airflow 2 plugins uses Flask to render the web UI.When initialized, predefined configuration
is used, based on the webserver
section of the airflow.cfg
file. You can override these settings
and add any extra settings by adding flask configuration to webserver_config.py
file specified in [fab] config_file
(by default it is $AIRFLOW_HOME/webserver_config.py
). This file is automatically loaded by the webserver.
For example if you would like to change rate limit strategy to “moving window”, you can set the
RATELIMIT_STRATEGY
to moving-window
.
You could also enhance / modify the underlying flask app directly,
as the app context is pushed to webserver_config.py
:
from flask import current_app as app
@app.before_requestq
def print_custom_message() -> None:
print("Executing before every request")