This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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) { |
OlderNewer