Skip to content

Commit 96c20c7

Browse files
committed
fix(): fix cookie same site issue
1 parent 7f9c3e6 commit 96c20c7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/brick-container/serve/getProxy.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,16 @@ export default function getProxy(env, getRawIndexHtml) {
116116
req.path === "/next/api/auth/login/v2" &&
117117
Array.isArray(setCookies)
118118
) {
119-
// - If the server is https, but the local is http, clear the secure cookie flags;
120-
// - Otherwise, if the local is localhost and cookieSameSiteNone is enabled (default),
119+
// - If the local is localhost and cookieSameSiteNone is enabled (default),
121120
// add the secure cookie flags;
122121
// - Otherwise, if the local is https, do nothing;
123122
// - Otherwise, clear the secure cookie flags;
124123
const strategy =
125-
env.server.startsWith("https:") && !env.https
126-
? "clear"
127-
: env.cookieSameSiteNone && env.host === "localhost"
128-
? "add"
129-
: env.https
130-
? null
131-
: "clear";
124+
env.cookieSameSiteNone && env.host === "localhost"
125+
? "add"
126+
: env.https
127+
? null
128+
: "clear";
132129
if (strategy) {
133130
// Note: it seems that now Chrome (v107) requires `SameSite=None` even for localhost.
134131
// However, `Secure` can use used with non-http for localhost.

0 commit comments

Comments
 (0)