From 8065df4ff0910f7616c1668ba40e3451291743d8 Mon Sep 17 00:00:00 2001 From: mstfyldz Date: Tue, 11 Aug 2026 10:50:58 +0300 Subject: [PATCH] fix: raise Express JSON body limit to 25mb for OCR image payloads Default 100kb limit rejected base64-encoded scanned page images with 413 Payload Too Large, breaking /documents/ocr-image for any realistic scan. --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 2d09874..04cec77 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,10 @@ const limiter = rateLimit({ }); app.use(cors()); -app.use(express.json()); +// Varsayılan limit (100kb) OCR için gönderilen base64 taranmış sayfa görsellerini +// (300KB-1MB+ ham, base64 ile ~%33 daha büyük) kolayca aşıyordu ve 413 Payload +// Too Large ile reddediliyordu — bkz. /documents/ocr-image. +app.use(express.json({ limit: '25mb' })); // If your app is behind a proxy (like Nginx, Docker ingress, etc.), // the IP will default to the proxy's IP. We set trust proxy to get the real client IP.