Summary
Uploading multiple large files consistently fails in production. What shows up in the browser looks like a CORS issue, but it’s actually timeouts under load.
That makes it harder to debug and breaks a normal workflow, uploading a batch of documents.
Environment
Frontend: https://app.mikeoss.com
API: https://api.mikeoss.com
Endpoints:
- POST /single-documents
- POST /projects/:projectId/documents
Reproduction
- Log into the app
- Upload ~20 files at ~40MB each
- Observe network tab and console
Actual Behaviour
- Requests fail with status 524
- Browser reports:
- "Origin not allowed by Access-Control-Allow-Origin"
- "Fetch API cannot load…"
- "TypeError: Load failed"
- Failures occur across both upload paths
- Frontend retries appear to amplify load
Expected Behaviour
- Uploads either succeed within supported limits
- Or fail cleanly with explicit responses (e.g. 413, 429, 503)
- All responses include valid CORS headers
- UI shows clear per-file outcomes
What’s Actually Happening
This is not a CORS issue. It’s timeout behaviour surfacing as CORS because the response does not complete properly.
Under load:
- Requests exceed execution window → Cloudflare returns 524
- Error responses bypass normal middleware
- CORS headers are missing → browser reports access control failure
Likely Causes
Synchronous processing in request path
Upload → parse → extract → respond in a single request does not scale under concurrency
Unbounded parallel uploads
Client sends multiple large files simultaneously without effective throttling
Memory pressure from request handling
Every JSON endpoint shares:
express.json({ limit: "50mb" })
Summary
Uploading multiple large files consistently fails in production. What shows up in the browser looks like a CORS issue, but it’s actually timeouts under load.
That makes it harder to debug and breaks a normal workflow, uploading a batch of documents.
Environment
Frontend: https://app.mikeoss.com
API: https://api.mikeoss.com
Endpoints:
Reproduction
Actual Behaviour
Expected Behaviour
What’s Actually Happening
This is not a CORS issue. It’s timeout behaviour surfacing as CORS because the response does not complete properly.
Under load:
Likely Causes
Synchronous processing in request path
Upload → parse → extract → respond in a single request does not scale under concurrency
Unbounded parallel uploads
Client sends multiple large files simultaneously without effective throttling
Memory pressure from request handling
Every JSON endpoint shares: