This is an automated email from the ASF dual-hosted git repository. jscheffl pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push: new d396533cfd Fix static file caching is disabled in Airflow Webserver. (#39345) d396533cfd is described below commit d396533cfd43c882f681966b0dd098a702f2eaf8 Author: Seongbin Hong <37045096+vertextoe...@users.noreply.github.com> 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 --- airflow/www/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/airflow/www/app.py b/airflow/www/app.py index 50e1ba2629..eb4362d70b 100644 --- a/airflow/www/app.py +++ b/airflow/www/app.py @@ -121,6 +121,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)