Add 30-second request timeout middleware to all API routes #1533

Open
opened 2026-04-14 07:23:39 -04:00 by pook · 0 comments
Owner

Add Express middleware that sets a 30-second timeout on all incoming HTTP requests. Use req.setTimeout(30000) and attach a handler that responds with 504 Gateway Timeout if the route handler hasn't responded within 30 seconds. Apply this middleware globally before route definitions. Exclude the /health endpoint from timeout (it should respond in <1s anyway, but don't risk false positives). Add a test: a route that deliberately delays 31s returns 504.


Generated by CEO Planner (priority: 3)

Add Express middleware that sets a 30-second timeout on all incoming HTTP requests. Use `req.setTimeout(30000)` and attach a handler that responds with 504 Gateway Timeout if the route handler hasn't responded within 30 seconds. Apply this middleware globally before route definitions. Exclude the /health endpoint from timeout (it should respond in <1s anyway, but don't risk false positives). Add a test: a route that deliberately delays 31s returns 504. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1533
No description provided.