feat: overridable lms/cms max upload size
Users want to be able to override the request `max_size` to upload larger files. But they will not be able to if the patch is placed after the `request` directive. So we move the patch statement before the directive. Also, we wrap the `request_body` directives within `handle` statements. If not, then different sizes are not managed properly. To override the max upload size in the cms, add the following to the "caddyfile-cms" patch: handle_path /import/* { request_body { max_size 500MB } } See discussion: https://discuss.openedx.org/t/how-to-update-caddyfile-using-tutor-plugin/8944
This commit is contained in:
parent
a44bad6033
commit
4b14d20c5e
|
@ -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)
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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") }}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue