Skip to content

Commit

Permalink
fix: address chrome cookie SameSite issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Juned Kazi committed Mar 24, 2020
1 parent 5f18c44 commit 5938ce1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions bin/stencil-start
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ function startServer() {
},
proxy: "localhost:" + stencilServerPort,
tunnel: tunnel,
https: Url.parse(staplerUrl).protocol === 'https:'
});

// Handle manual reloading of browsers by typing 'rs';
Expand Down
2 changes: 1 addition & 1 deletion server/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function stripDomainFromCookies(cookies) {
const fixedCookies = [];

_.forEach(cookies, function(cookie) {
fixedCookies.push(cookie.replace(/(?:;\s)?domain=(?:.+?)(;|$)/, '$1'));
fixedCookies.push(cookie.replace(/(?:;\s)?domain=(?:.+?)(;|$)/, '$1').replace('; SameSite=none', ''));
});

return fixedCookies;
Expand Down
4 changes: 4 additions & 0 deletions server/plugins/renderer/renderer.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ internals.parseResponse = function (bcAppData, request, response, responseArgs,
response: response,
}, internals.cacheTTL);

if (response.headers['set-cookie']) {
response.headers['set-cookie'] = Utils.stripDomainFromCookies(response.headers['set-cookie']);
}

return callback(null, internals.getPencilResponse(data, request, response, configuration));
});
}
Expand Down

0 comments on commit 5938ce1

Please sign in to comment.