Skip to content

Commit

Permalink
remove more from custom server
Browse files Browse the repository at this point in the history
  • Loading branch information
tsubik committed Jul 3, 2024
1 parent 952e278 commit c2d2e3f
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,9 @@ app
res.json({});
});

server.use(
'/static',
express.static(`${__dirname}/static`, {
maxAge: '365d',
})
);

server.get(/^\/_next\/static\/(fonts|images)\//, (_, res, nextHandler) => {
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
nextHandler();
});

// Default catch-all handler to allow Next.js to handle all other routes
server.all('*', (req, res) => handle(req, res));

// Set vary header (good practice)
// Note: This overrides any existing 'Vary' header but is okay in this app
server.use((req, res, _next) => {
res.setHeader('Vary', 'Accept-Encoding');
_next();
});

server.listen(process.env.PORT, (err) => {
if (err) {
throw err;
Expand Down

0 comments on commit c2d2e3f

Please sign in to comment.