This is an automated email from the ASF dual-hosted git repository. ephraimanierobi pushed a commit to branch v2-9-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit ea3e24a00b0b0d63a6eda6fb635350c805190cef Author: Seongbin Hong <[email protected]> AuthorDate: Sun May 5 04:43:52 2024 +0900 Fix static file caching is disabled in Airflow Webserver. (#39345) * Fix static file caching is disabled in Airflow Webserver. In Airflow 2.3.0, it's Flask version is bumped up to 2.0.x Flask 2.0.x has some breaking changes. one of them is about `SEND_FILE_MAX_AGE_DEFAULT`. It affect static file's Expires value on HTTP response header. and the default value is changed from 12 hours to None on that version. in order to enable static file caching in airflow webserver. it needs explicitly configration of `SEND_FILE_MAX_AGE_DEFAULT` in Flask. * Fix typo * Fix code's formatting with ruff (cherry picked from commit d396533cfd43c882f681966b0dd098a702f2eaf8) --- airflow/www/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/airflow/www/app.py b/airflow/www/app.py index 17a4c681dd..7f4405321f 100644 --- a/airflow/www/app.py +++ b/airflow/www/app.py @@ -120,6 +120,10 @@ def create_app(config=None, testing=False): cookie_samesite_config = "Lax" flask_app.config["SESSION_COOKIE_SAMESITE"] = cookie_samesite_config + # Above Flask 2.0.x, default value of SEND_FILE_MAX_AGE_DEFAULT changed 12 hours to None. + # for static file caching, it needs to set value explicitly. + flask_app.config["SEND_FILE_MAX_AGE_DEFAULT"] = timedelta(seconds=43200) + if config: flask_app.config.from_mapping(config)
