From b96c8db3def29fb84f3a41c2261f898691bae328 Mon Sep 17 00:00:00 2001 From: Daniel Volz Date: Sat, 20 Dec 2025 21:21:49 +0100 Subject: [PATCH] feat: increase file upload limit to 10MB for medication images --- backend/src/index.ts | 2 +- frontend/nginx.conf | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 1e55fea..ec9701e 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -70,7 +70,7 @@ await app.register(rateLimit, { }); await app.register(cookie, { secret: env.COOKIE_SECRET }); await app.register(jwt, { secret: env.JWT_SECRET, cookie: { cookieName: "access_token", signed: false } }); -await app.register(fastifyMultipart, { limits: { fileSize: 2 * 1024 * 1024 } }); // 2MB limit +await app.register(fastifyMultipart, { limits: { fileSize: 10 * 1024 * 1024 } }); // 10MB limit await app.register(fastifyStatic, { root: imagesDir, prefix: "/images/", diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 2292173..7bfad8c 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -5,6 +5,9 @@ server { root /usr/share/nginx/html; index index.html; + # Allow larger file uploads (for medication images) + client_max_body_size 10M; + location / { try_files $uri /index.html; } @@ -13,5 +16,11 @@ server { proxy_pass http://backend:3000/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # Timeout for uploads + proxy_read_timeout 60s; + proxy_send_timeout 60s; } }