Skip to content

Commit df04ec7

Browse files
turegjorupclaude
andcommitted
Align upload limits with new MEDIA_MAX_UPLOAD_SIZE_MB app cap
Upstream display-api-service 3.0.0 introduces a Symfony-level upload ceiling (MEDIA_MAX_UPLOAD_SIZE_MB, default 200 MiB) enforced on Media::$file. The cap flows into .env.symfony automatically via task env:init, but the PHP and nginx example defaults shipped here (128M / 140M / 140m) were below it — large uploads would have been rejected at the proxy/PHP layer with an opaque 413 instead of the app's clear validator error. Bumps PHP_UPLOAD_MAX_FILESIZE to 200M, PHP_POST_MAX_SIZE to 210M, and NGINX_MAX_BODY_SIZE to 210m so the four-layer inequality holds out of the box. UPGRADE.md gets a new sub-section spelling out the alignment rule and an env:diff verification step for operators whose migrated .env.symfony predates the new var. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 871a2c1 commit df04ec7

4 files changed

Lines changed: 34 additions & 7 deletions

File tree

.env.nginx.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
# Request limits
1212
###
1313
# Max request body size accepted by nginx. Must be >= PHP_UPLOAD_MAX_FILESIZE
14-
# in .env.php, otherwise large uploads get truncated at the proxy. Default: 140m.
15-
NGINX_MAX_BODY_SIZE=140m
14+
# in .env.php and >= MEDIA_MAX_UPLOAD_SIZE_MB in .env.symfony (app cap, default
15+
# 200 MiB), otherwise large uploads get truncated at the proxy. Default: 210m.
16+
NGINX_MAX_BODY_SIZE=210m
1617

1718
###
1819
# Upstream FPM (rarely needs tuning — only useful with custom topology)

.env.php.example

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
PHP_MAX_EXECUTION_TIME=30
1414
# Memory cap per PHP process. Default: 128M.
1515
PHP_MEMORY_LIMIT=256M
16-
# Total POST body size accepted by PHP. Default: 8M. Raise in lockstep with
17-
# NGINX_MAX_BODY_SIZE.
18-
PHP_POST_MAX_SIZE=140M
19-
# Maximum size of an uploaded file. Default: 2M.
20-
PHP_UPLOAD_MAX_FILESIZE=128M
16+
# Total POST body size accepted by PHP. Default: 8M. Keep in lockstep with
17+
# NGINX_MAX_BODY_SIZE and >= PHP_UPLOAD_MAX_FILESIZE plus multipart overhead.
18+
PHP_POST_MAX_SIZE=210M
19+
# Maximum size of an uploaded file. Default: 2M. The Symfony app caps media
20+
# uploads at MEDIA_MAX_UPLOAD_SIZE_MB (.env.symfony, default 200 MiB); this
21+
# must be >= that value, otherwise PHP rejects the upload before the app
22+
# validator sees it.
23+
PHP_UPLOAD_MAX_FILESIZE=200M
2124
# Default timezone. Default: Europe/Copenhagen.
2225
PHP_TIMEZONE=Europe/Copenhagen
2326

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ See the [v2.x.x — Skipped](#v2xx---skipped) entry below for why this major ski
4545
`logs:access`, `logs:disk`.
4646
- Global JSON-file log rotation (10MB × 3 files per service), tunable via `LOG_MAX_SIZE` /
4747
`LOG_MAX_FILE`.
48+
- Aligned media-upload limits with the upstream 3.0.0 app cap: `.env.php.example` ships
49+
`PHP_UPLOAD_MAX_FILESIZE=200M` / `PHP_POST_MAX_SIZE=210M` and `.env.nginx.example` ships
50+
`NGINX_MAX_BODY_SIZE=210m`, matching the new `MEDIA_MAX_UPLOAD_SIZE_MB=200` Symfony validator
51+
ceiling that 3.0.0 introduces. UPGRADE.md §5 explains the four-layer alignment rule.
4852

4953
### Local development
5054

UPGRADE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,25 @@ $EDITOR .env.mariadb
175175
task env:traefik
176176
```
177177

178+
##### Media upload size: align all three layers
179+
180+
v3 adds an app-level cap on media uploads, `MEDIA_MAX_UPLOAD_SIZE_MB` (default `200`,
181+
in MiB), enforced by the Symfony validator on `Media::$file`. Because uploads cross
182+
nginx → PHP-FPM → Symfony, all three layers must agree, or the lowest wins (and the
183+
operator sees a confusing 413 / `UPLOAD_ERR_INI_SIZE` instead of the app's clear
184+
"file exceeds N MiB" error). Defaults shipped in `.env.php.example` and
185+
`.env.nginx.example` are aligned to `200`; if you've customised any of them, keep
186+
the inequality intact:
187+
188+
```
189+
NGINX_MAX_BODY_SIZE >= PHP_POST_MAX_SIZE >= PHP_UPLOAD_MAX_FILESIZE >= MEDIA_MAX_UPLOAD_SIZE_MB
190+
```
191+
192+
`task env:migrate` carries `MEDIA_MAX_UPLOAD_SIZE_MB` over from the image's bundled
193+
`.env`, so it lands in `.env.symfony` automatically. Verify with `task env:diff` after
194+
`env:init` — if the diff shows the key only on the image side, your migrated file
195+
predates this var and you should copy the line over by hand.
196+
178197
#### 6. MariaDB 10.x → 11.4 upgrade
179198

180199
The bundled MariaDB is `mariadb:11.4.10` in 3.x (was `mariadb:10.x` in 1.x). Three things must

0 commit comments

Comments
 (0)