fix(medusa): secure cookies in staging
This commit is contained in:
@@ -8,6 +8,13 @@ import createStore from "connect-redis"
|
|||||||
import config from "../config"
|
import config from "../config"
|
||||||
|
|
||||||
export default async ({ app, configModule }) => {
|
export default async ({ app, configModule }) => {
|
||||||
|
let sameSite = false
|
||||||
|
let secure = false
|
||||||
|
if (process.env.NODE_ENV === "production" || process.env.NODE_ENV === "staging") {
|
||||||
|
secure = true
|
||||||
|
sameSite = "none"
|
||||||
|
}
|
||||||
|
|
||||||
const RedisStore = createStore(session)
|
const RedisStore = createStore(session)
|
||||||
const redisClient = redis.createClient(configModule.projectConfig.redis_url)
|
const redisClient = redis.createClient(configModule.projectConfig.redis_url)
|
||||||
|
|
||||||
@@ -27,8 +34,8 @@ export default async ({ app, configModule }) => {
|
|||||||
proxy: true,
|
proxy: true,
|
||||||
secret: config.cookieSecret,
|
secret: config.cookieSecret,
|
||||||
cookie: {
|
cookie: {
|
||||||
sameSite: process.env.NODE_ENV === "production" ? "none" : false,
|
sameSite,
|
||||||
secure: process.env.NODE_ENV === "production",
|
secure,
|
||||||
maxAge: 10 * 60 * 60 * 1000,
|
maxAge: 10 * 60 * 60 * 1000,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user