Skip to content

Commit

Permalink
extend request timeouts for upload endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
TimCsaky committed Oct 5, 2023
1 parent cbc7277 commit 9affa76
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/middleware/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const currentUpload = (strict = false) => {
return (req, res, next) => {
// Check Content-Length Header
const contentLength = parseInt(req.get('Content-Length'));
// set a longer request timeout for large file uploads
// req.socket.server.requestTimeout = Math.max(300000, contentLength);
req.setTimeout(Math.max(300000, contentLength));
// TODO: Figure out what's killing and returning a 400 in response stack
if (!contentLength) return new Problem(411, { detail: 'Content-Length must be greater than 0' }).send(res);

Expand Down

0 comments on commit 9affa76

Please sign in to comment.