auth-backend: switch over to use auto secure cookies

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-01-10 17:35:02 +01:00
parent 416323397a
commit 20ca7cfa5f
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-auth-backend': patch
---
Switched the secure cookie mode set on the `express-session` to use `'auto'` rather than `true`. This works around an issue where cookies would not be set if TLS termination was handled in a proxy rather than having the backend served directly with HTTPS.
The downside of this change is that secure cookies won't be used unless the backend is directly served with HTTPS. This will be remedied in a future update that allows the backend to configured for trusted proxy mode.
+1 -1
View File
@@ -74,7 +74,7 @@ export async function createRouter(
secret,
saveUninitialized: false,
resave: false,
cookie: { secure: enforceCookieSSL },
cookie: { secure: enforceCookieSSL ? 'auto' : false },
}),
);
router.use(passport.initialize());