From 0b396eb6543f65f773e8d31832e684e1ecdef9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 8 Dec 2023 19:05:48 +0100 Subject: [PATCH] feature/Set secure option conditionally --- server/app.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/app.ts b/server/app.ts index b5d6535..e4b015a 100644 --- a/server/app.ts +++ b/server/app.ts @@ -8,6 +8,9 @@ import path from 'path' const port = 8085 const app: Application = express() +const host = process.env.VITE_OBP_EXPLORER_HOST +const httpsOrNot = host ? host.indexOf("https://") == 0 ? true : false : true + app.use(express.json()) app.use( session({ @@ -16,8 +19,8 @@ app.use( saveUninitialized: true, cookie: { httpOnly: true, - secure: true, - maxAge: 300*1000, // 5 minutes in milliseconds + secure: httpsOrNot, + maxAge: 10*1000, // 5 minutes in milliseconds } }) )