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 <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2024-01-31 14:23:55 +01:00 committed by Tilman Vatteroth
parent 5e2c766388
commit 307a634157
2 changed files with 2 additions and 1 deletions

2
app.js
View file

@ -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

View file

@ -7,6 +7,7 @@
### Bugfixes
- Fix a crash when having numeric-only values in opengraph frontmatter
- Fix unnecessary session creation on healthcheck endpoint
## <i class="fa fa-tag"></i> 1.9.9 <i class="fa fa-calendar-o"></i> 2023-07-30