Skip to content

Commit

Permalink
Fix production cookie settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MarwanRadwan7 committed Jul 18, 2024
1 parent f76e5db commit 18f5019
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/evershop/bin/lib/addDefaultMiddlewareFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ exports.addDefaultMiddlewareFuncs = function addDefaultMiddlewareFuncs(

if (isProductionMode()) {
app.set('trust proxy', 1);
sess.cookie.secure = false;
sess.cookie.secure = true; // HTTPS

This comment has been minimized.

Copy link
@treoden

treoden Jul 19, 2024

Collaborator

Hi @MarwanRadwan7

I concern this will produce an issue when testing production mode on localhost?

This comment has been minimized.

Copy link
@MarwanRadwan7

MarwanRadwan7 Jul 28, 2024

Author

@treoden
You are right. It would be an issue with testing without HTTPS.
We can use an extra environment variable for that or leave it for now !

sess.cookie.sameSite = 'strict'; // Prevent CSRF attacks
}

const adminSessionMiddleware = session({
Expand Down

0 comments on commit 18f5019

Please sign in to comment.