From 4c905e69ae0c85872b8f0b295ba559245d0c7d59 Mon Sep 17 00:00:00 2001 From: SandObserver <260779319+SandObserver@users.noreply.github.com> Date: Sat, 17 Oct 2026 10:16:36 -0400 Subject: [PATCH] Keep API request bodies in nginx memory Set client_body_buffer_size 3m on the /api/ location. A saved config over 16 KB was written to a temporary file with a warning on every save. --- api/test/nginx-config.test.js | 7 +++++++ nginx/dashboard.conf | 1 + 2 files changed, 8 insertions(+) diff --git a/api/test/nginx-config.test.js b/api/test/nginx-config.test.js index 1613217f..f023ee4e 100644 --- a/api/test/nginx-config.test.js +++ b/api/test/nginx-config.test.js @@ -537,3 +537,10 @@ test('translation catalogs are stored and revalidated, not refetched in full', ( assert.match(block, /add_header Cache-Control "no-cache";/); assert.doesNotMatch(block, /no-store/); }); + +test('the API location keeps any body the API accepts in memory', () => { + const block = /location\s+\/api\/\s*\{([\s\S]*?)\n {4}\}/.exec(dashboard); + assert.ok(block, 'no /api/ location'); + const buffer = nginxSize(block[1], 'client_body_buffer_size'); + assert.ok(buffer >= BODY_LIMIT, `nginx buffers ${buffer} in memory but the API accepts bodies up to ${BODY_LIMIT}`); +}); diff --git a/nginx/dashboard.conf b/nginx/dashboard.conf index 99d1a03e..c04b085f 100644 --- a/nginx/dashboard.conf +++ b/nginx/dashboard.conf @@ -197,6 +197,7 @@ server { # ── API proxy ── location /api/ { + client_body_buffer_size 3m; proxy_pass http://127.0.0.1:3000; # $http_host, not $host: nginx strips the port from $host while a # browser's Origin keeps it, and the API compares the two.