diff --git a/changelog.d/20230130_112932_regis_overridable_caddy_max_upload.md b/changelog.d/20230130_112932_regis_overridable_caddy_max_upload.md new file mode 100644 index 0000000..7a92a51 --- /dev/null +++ b/changelog.d/20230130_112932_regis_overridable_caddy_max_upload.md @@ -0,0 +1 @@ +- [Improvement] Make it possible to override the max upload size in the LMS and the CMS. This is achieved by moving the "caddyfile-lms" and "caddyfile-cms" patches just before the `import proxy` declarations. We also wrap the `request_body` directives within `handle` statements, which means that the `max_body` sizes can be overridden for specific paths. (by @regisb) diff --git a/docs/configuration.rst b/docs/configuration.rst index b156950..92ca091 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -67,7 +67,7 @@ This configuration parameter defines the name of the Docker image to run for the This configuration paramater defines the name of the Docker image to run the development version of the lms and cms containers. By default, the Docker image tag matches the Tutor version it was built with. -- ``DOCKER_IMAGE_CADDY`` (default: ``"docker.io/caddy:2.4.6"``) +- ``DOCKER_IMAGE_CADDY`` (default: ``"docker.io/caddy:2.6.2"``) This configuration paramater defines which Caddy Docker image to use. diff --git a/tutor/templates/apps/caddy/Caddyfile b/tutor/templates/apps/caddy/Caddyfile index 46a5559..b361193 100644 --- a/tutor/templates/apps/caddy/Caddyfile +++ b/tutor/templates/apps/caddy/Caddyfile @@ -37,16 +37,21 @@ rewrite @favicon_matcher /theming/asset/images/favicon.ico # Limit profile image upload size - request_body /api/profile_images/*/*/upload { - max_size 1MB - } - request_body { - max_size 4MB + handle_path /api/profile_images/*/*/upload { + request_body { + max_size 1MB + } } import proxy "lms:8000" {{ patch("caddyfile-lms")|indent(4) }} + + handle_path /* { + request_body { + max_size 4MB + } + } } {{ CMS_HOST }}{$default_site_port} { @@ -55,13 +60,15 @@ } rewrite @favicon_matcher /theming/asset/images/favicon.ico - request_body { - max_size 250MB - } - import proxy "cms:8000" {{ patch("caddyfile-cms")|indent(4) }} + + handle_path /* { + request_body { + max_size 250MB + } + } } {{ patch("caddyfile") }} diff --git a/tutor/templates/config/defaults.yml b/tutor/templates/config/defaults.yml index 819a476..3bee19b 100644 --- a/tutor/templates/config/defaults.yml +++ b/tutor/templates/config/defaults.yml @@ -12,7 +12,7 @@ DOCKER_COMPOSE_VERSION: "3.7" DOCKER_REGISTRY: "docker.io/" DOCKER_IMAGE_OPENEDX: "{{ DOCKER_REGISTRY }}overhangio/openedx:{{ TUTOR_VERSION }}" DOCKER_IMAGE_OPENEDX_DEV: "openedx-dev:{{ TUTOR_VERSION }}" -DOCKER_IMAGE_CADDY: "docker.io/caddy:2.4.6" +DOCKER_IMAGE_CADDY: "docker.io/caddy:2.6.2" DOCKER_IMAGE_ELASTICSEARCH: "docker.io/elasticsearch:7.10.1" DOCKER_IMAGE_MONGODB: "docker.io/mongo:4.2.17" DOCKER_IMAGE_MYSQL: "docker.io/mysql:5.7.35"