From 307a63415711b74b0bb584e13dd73f6db233dcd7 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Wed, 31 Jan 2024 14:23:55 +0100 Subject: [PATCH] fix(router): do not create sessions for /_health When the /_health endpoint for the docker container healthcheck was introduced, it seems that it was forgotten to exclude that route from the session creation. As the healthcheck runs quite periodically, this created a huge amount of session entries in the database. This commit excludes the route from session creation. Signed-off-by: Erik Michelson --- app.js | 2 +- public/docs/release-notes.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index f40358981..656c50834 100644 --- a/app.js +++ b/app.js @@ -152,7 +152,7 @@ app.use('/uploads', express.static(path.resolve(__dirname, config.uploadsPath), app.use('/default.md', express.static(path.resolve(__dirname, config.defaultNotePath), { maxAge: config.staticCacheTime })) // session -app.use(useUnless(['/status', '/metrics'], session({ +app.use(useUnless(['/status', '/metrics', '/_health'], session({ name: config.sessionName, secret: config.sessionSecret, resave: false, // don't save session if unmodified diff --git a/public/docs/release-notes.md b/public/docs/release-notes.md index fee0a924a..8a9780843 100644 --- a/public/docs/release-notes.md +++ b/public/docs/release-notes.md @@ -7,6 +7,7 @@ ### Bugfixes - Fix a crash when having numeric-only values in opengraph frontmatter +- Fix unnecessary session creation on healthcheck endpoint ## 1.9.9 2023-07-30