From 6ea2f291c6ad3100a5e70c5f2a09cca1bf3bf8c9 Mon Sep 17 00:00:00 2001 From: arlophoenix Date: Mon, 27 Jul 2026 07:50:24 +1200 Subject: [PATCH 1/2] Give the fluidd webcam locations the same streaming directives as mainsail The mainsail server block sets postpone_output 0, proxy_buffering off and proxy_ignore_headers X-Accel-Buffering on every /webcam*/ location; the fluidd block sets none of them. With buffering left on, nginx spools an MJPEG stream a client cannot drain fast enough into its proxy temp directory. That directory is the compiled default /var/tmp/nginx/proxy, and on CrealityOS /var/tmp is a symlink to /tmp, which is tmpfs -- so the spill lands in RAM. This only makes the file consistent with itself; the mainsail block is unchanged. --- files/moonraker/nginx.conf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/files/moonraker/nginx.conf b/files/moonraker/nginx.conf index c7262d1..bf3c9e8 100644 --- a/files/moonraker/nginx.conf +++ b/files/moonraker/nginx.conf @@ -65,18 +65,38 @@ http { } location /webcam/ { + postpone_output 0; + proxy_buffering off; + proxy_ignore_headers X-Accel-Buffering; + access_log off; + error_log off; proxy_pass http://mjpgstreamer1/; } location /webcam2/ { + postpone_output 0; + proxy_buffering off; + proxy_ignore_headers X-Accel-Buffering; + access_log off; + error_log off; proxy_pass http://mjpgstreamer2/; } location /webcam3/ { + postpone_output 0; + proxy_buffering off; + proxy_ignore_headers X-Accel-Buffering; + access_log off; + error_log off; proxy_pass http://mjpgstreamer3/; } location /webcam4/ { + postpone_output 0; + proxy_buffering off; + proxy_ignore_headers X-Accel-Buffering; + access_log off; + error_log off; proxy_pass http://mjpgstreamer4/; } } From b1808bd0e6b6c8d284839d4940881fcda1777ed3 Mon Sep 17 00:00:00 2001 From: arlophoenix Date: Mon, 27 Jul 2026 07:50:33 +1200 Subject: [PATCH 2/2] Never spool a proxied response to a temp file proxy_max_temp_file_size defaults to 1024 MB. On these boxes the proxy temp path resolves into a ~100 MB tmpfs on a ~200 MB machine, so the default is an invitation to exhaust RAM. Setting it to 0 makes nginx pass proxied responses through synchronously and never write a temp file, so a slow client throttles the upstream instead of consuming memory. This covers every proxied response, not just the webcam -- including large /server/files/... gcode reads, which are routinely ~100 MB. Deliberately not relocating proxy_temp_path to /usr/data: that would trade RAM exhaustion for continuous eMMC writes on every stream. --- files/moonraker/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/files/moonraker/nginx.conf b/files/moonraker/nginx.conf index bf3c9e8..fafc562 100644 --- a/files/moonraker/nginx.conf +++ b/files/moonraker/nginx.conf @@ -14,6 +14,7 @@ http { proxy_send_timeout 1600; proxy_read_timeout 1600; send_timeout 1600; + proxy_max_temp_file_size 0; server { listen 4408 default_server;