diff options
Diffstat (limited to 'packages/integrations/node/src')
-rw-r--r-- | packages/integrations/node/src/http-server.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/integrations/node/src/http-server.ts b/packages/integrations/node/src/http-server.ts index 850d61bbb..2c58c0da7 100644 --- a/packages/integrations/node/src/http-server.ts +++ b/packages/integrations/node/src/http-server.ts @@ -55,7 +55,13 @@ export function createServer( // File not found, forward to the SSR handler handler(req, res); }); - + stream.on('directory', () => { + // On directory find, redirect to the trailing slash + const location = req.url + '/'; + res.statusCode = 301 + res.setHeader('Location', location); + res.end(location); + }); stream.on('file', () => { forwardError = true; }); |