This is an automated email from the ASF dual-hosted git repository.

husseinawala 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 84063e74fb Add flask config: `MAX_CONTENT_LENGTH` (#36401)
84063e74fb is described below

commit 84063e74fb2b0dd3a8308ff4170cb3e7236cf51e
Author: y.yoshida5 <39612448+yo1...@users.noreply.github.com>
AuthorDate: Sat Dec 30 23:55:30 2023 +0900

    Add flask config: `MAX_CONTENT_LENGTH` (#36401)
---
 airflow/config_templates/config.yml | 7 +++++++
 airflow/www/app.py                  | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/airflow/config_templates/config.yml 
b/airflow/config_templates/config.yml
index 0930fada76..059467e4a0 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -1855,6 +1855,13 @@ webserver:
       type: boolean
       example: "False"
       default: "False"
+    allowed_payload_size:
+      description: |
+        The maximum size of the request payload (in MB) that can be sent.
+      version_added: 2.8.1
+      type: float
+      example: ~
+      default: "1.0"
 email:
   description: |
     Configuration email backend and whether to
diff --git a/airflow/www/app.py b/airflow/www/app.py
index b8be40a421..749efe8912 100644
--- a/airflow/www/app.py
+++ b/airflow/www/app.py
@@ -75,6 +75,8 @@ def create_app(config=None, testing=False):
 
     flask_app.config["PERMANENT_SESSION_LIFETIME"] = 
timedelta(minutes=settings.get_session_lifetime_config())
 
+    flask_app.config["MAX_CONTENT_LENGTH"] = conf.getfloat("webserver", 
"allowed_payload_size") * 1024 * 1024
+
     webserver_config = conf.get_mandatory_value("webserver", "config_file")
     # Enable customizations in webserver_config.py to be applied via 
Flask.current_app.
     with flask_app.app_context():

Reply via email to