diff --git a/src/web/server.ts b/src/web/server.ts
index 9c44807f94..a1b7130baf 100644
--- a/src/web/server.ts
+++ b/src/web/server.ts
@@ -29,7 +29,7 @@ app.use(compression());
 app.use((req, res, next) => {
 	res.header('X-Frame-Options', 'DENY');
 
-	res.locals.user = (req.headers['cookie'].match(/i=(!\w+)/) || [null, null])[1];
+	res.locals.user = ((req.headers['cookie'] || '').match(/i=(!\w+)/) || [null, null])[1];
 
 	next();
 });