Set a request size limit of 5MB

This is to replicate the nginx behaviour. If the entire request is
larger than MAX_CONTENT_LENGTH [1] an entity too large error is raised
[2].

Enable for all environments except Staging and Production (i.e.
Development, Preview, Test)

1: https://flask.palletsprojects.com/en/1.1.x/patterns/fileuploads/#improving-uploads
2: https://werkzeug.palletsprojects.com/en/1.0.x/exceptions/#werkzeug.exceptions.RequestEntityTooLarge
This commit is contained in:
sakisv
2021-01-26 17:58:45 +02:00
parent 51c0ece130
commit d35ab04a4e

View File

@@ -381,6 +381,7 @@ class Config(object):
CBC_PROXY_ENABLED = bool(CBC_PROXY_AWS_ACCESS_KEY_ID)
ENABLED_CBCS = {BroadcastProvider.EE, BroadcastProvider.THREE, BroadcastProvider.O2, BroadcastProvider.VODAFONE}
MAX_CONTENT_LENGTH = 5 * 1024 * 1024 # 5MB
######################
@@ -508,6 +509,8 @@ class Staging(Config):
API_RATE_LIMIT_ENABLED = True
CHECK_PROXY_HEADER = True
MAX_CONTENT_LENGTH = None
class Live(Config):
NOTIFY_EMAIL_DOMAIN = 'notifications.service.gov.uk'
@@ -529,6 +532,8 @@ class Live(Config):
CRONITOR_ENABLED = True
MAX_CONTENT_LENGTH = None
class CloudFoundryConfig(Config):
pass