From db48e6e00d1c3318a2b69f6de2be8b0a29420b11 Mon Sep 17 00:00:00 2001 From: Boris Kurktchiev Date: Fri, 11 Sep 2026 10:23:58 -0400 Subject: [PATCH] web: nginx allows 5 MiB on /api/ to match the API (#160 finding 10); SELF_HOSTING names the proxy body limit --- docs/SELF_HOSTING.md | 4 +++- web/nginx.conf.template | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/SELF_HOSTING.md b/docs/SELF_HOSTING.md index c639d8d..3534d6f 100644 --- a/docs/SELF_HOSTING.md +++ b/docs/SELF_HOSTING.md @@ -80,7 +80,9 @@ gym.example.com { ### Option C — Traefik / nginx / Nginx Proxy Manager Route `gym.example.com` (HTTPS) → `web:80` (or `:8080`). Any reverse proxy works — -openGym only needs the browser to reach it over `https://gym.example.com`. +openGym only needs the browser to reach it over `https://gym.example.com`. If that proxy caps +request bodies (nginx does, at 1 MiB by default), allow at least 5 MiB on `/api/` — the app syncs +its whole history in one PUT; the bundled web image already allows 5 MiB, matching the API. Then set your domain in `.env` and restart: diff --git a/web/nginx.conf.template b/web/nginx.conf.template index f92ce83..e698efc 100644 --- a/web/nginx.conf.template +++ b/web/nginx.conf.template @@ -20,6 +20,10 @@ server { # as /api/anything.json would be matched by the \.(js|css|json|html)$ block instead and be # looked for on disk rather than proxied. location ^~ /api/ { + # Match the API's own body limit (MAX_BODY in api/server.js): the whole workout history + # travels in one PUT /api/data, and nginx's 1 MiB default would answer 413 here before the + # API ever saw it — a sync that silently stops once the history grows past 1 MiB. + client_max_body_size 5m; # Resolved per request through Docker's DNS, not once at start-up: nginx otherwise pins # the api container's IP when it boots, and a recreated api (new IP) means 502 on every # /api call until web is restarted too (issue #16). The variable is what makes nginx