Skip to content
Snippets Groups Projects
Commit e09b78cf authored by Grant's avatar Grant
Browse files

vary express & express-session options depending on environment (fixes #21)

parent cd62fc4f
No related branches found
No related tags found
No related merge requests found
...@@ -16,8 +16,12 @@ export const session = expressSession({ ...@@ -16,8 +16,12 @@ export const session = expressSession({
prefix: process.env.REDIS_SESSION_PREFIX || "canvas_session:", prefix: process.env.REDIS_SESSION_PREFIX || "canvas_session:",
}), }),
cookie: { cookie: {
sameSite: "none",
httpOnly: false, httpOnly: false,
...(process.env.NODE_ENV === "development"
? { sameSite: "none" }
: {
secure: true,
}),
}, },
}); });
...@@ -27,6 +31,11 @@ export class ExpressServer { ...@@ -27,6 +31,11 @@ export class ExpressServer {
constructor() { constructor() {
this.app = express(); this.app = express();
if (process.env.NODE_ENV === "production") {
this.app.set("trust proxy", 1);
}
this.httpServer = http.createServer(this.app); this.httpServer = http.createServer(this.app);
if (process.env.SERVE_CLIENT) { if (process.env.SERVE_CLIENT) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment