Skip to content

Instantly share code, notes, and snippets.

View fago's full-sized avatar

Wolfgang Ziegler fago

View GitHub Profile
// server/plugins/alb-timeout-handler.ts
export default defineNitroPlugin((nitroApp) => {
// If ALB timeout is 60s, set app timeout to 58s
const ALB_TIMEOUT = 60000
const APP_TIMEOUT = ALB_TIMEOUT - 2000 // 2s buffer
nitroApp.hooks.hook('request', async (event) => {
const timeout = setTimeout(() => {
// Check if response was already sent
if (!event.node.res.headersSent) {