From b2a66099aaf79dee37f2051d046a2f13d6c06be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20D=C3=A9siles?= <1536672+cdesiles@users.noreply.github.com> Date: Sat, 30 May 2026 17:18:05 +0200 Subject: [PATCH] fix(immich): prevent client SocketTimeoutException on large uploads Add missing nginx directives recommended by Immich docs for mobile photo backup over slow links: - http2 on: multiplex parallel asset uploads from the mobile app - client_body_timeout / send_timeout / keepalive_timeout 600s: cover the client<->nginx leg (default 60s matched the Android timeout) - proxy_request_buffering off + proxy_buffering off: stream upload bytes to immich as they arrive instead of buffering the whole file, keeping the TCP connection active and avoiding idle-socket timeouts - proxy_connect_timeout 600s: explicit upstream connect timeout --- roles/immich/templates/nginx-vhost.conf.j2 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/roles/immich/templates/nginx-vhost.conf.j2 b/roles/immich/templates/nginx-vhost.conf.j2 index 4aeb559..09c2287 100644 --- a/roles/immich/templates/nginx-vhost.conf.j2 +++ b/roles/immich/templates/nginx-vhost.conf.j2 @@ -20,6 +20,7 @@ server { server { listen 443 ssl; listen [::]:443 ssl; + http2 on; server_name {{ immich_nginx_hostname }}; # Let's Encrypt certificates (managed by Certbot) @@ -40,6 +41,12 @@ server { client_max_body_size 50000M; + # Timeouts for slow mobile uploads (client <-> nginx leg) + client_body_timeout 600s; + client_header_timeout 600s; + send_timeout 600s; + keepalive_timeout 600s; + location / { proxy_pass http://127.0.0.1:{{ immich_port }}; proxy_set_header Host $http_host; @@ -52,7 +59,12 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - # Timeouts for large file uploads + # Stream uploads directly to backend instead of buffering full body on disk + proxy_request_buffering off; + proxy_buffering off; + + # Timeouts for large file uploads (nginx <-> immich leg) + proxy_connect_timeout 600s; proxy_read_timeout 600s; proxy_send_timeout 600s; }