From 991b7ee815d32cb7e17ce51904d007596e8ec862 Mon Sep 17 00:00:00 2001 From: Kenneth Tan Xin You Date: Wed, 18 Aug 2021 16:27:40 +0800 Subject: [PATCH] Add debug log for pathname mismatch closes #840 --- HISTORY.md | 1 + index.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index ef77098b..ea175bdb 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,7 @@ unreleased ========== + * Add debug log for pathname mismatch * Add `partitioned` to `cookie` options * Add `priority` to `cookie` options * Fix handling errors from setting cookie diff --git a/index.js b/index.js index 981262cc..d41b2378 100644 --- a/index.js +++ b/index.js @@ -193,7 +193,11 @@ function session(options) { // pathname mismatch var originalPath = parseUrl.original(req).pathname || '/' - if (originalPath.indexOf(cookieOptions.path || '/') !== 0) return next(); + if (originalPath.indexOf(cookieOptions.path || '/') !== 0) { + debug('pathname mismatch') + next() + return + } // ensure a secret is available or bail if (!secret && !req.secret) {