Skip to content

Commit 2383dbf

Browse files
committed
Add config flag to enable httponly session cookies
1 parent 9b5050f commit 2383dbf

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

packages/pwa-kit-dev/bin/pwa-kit-dev.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,16 @@ const main = async () => {
253253
error('Could not determine app entrypoint.')
254254
process.exit(1)
255255
}
256-
256+
// Load config to get envBasePath from ssrParameters for local development
257+
// This mimics how MRT sets the MRT_ENV_BASE_PATH system environment variable
258+
const config = getConfig() || {}
259+
const disableHttpOnlySessionCookies =
260+
config.ssrParameters?.disableHttpOnlySessionCookies || true
257261
execSync(`${babelNode} ${inspect ? '--inspect' : ''} ${babelArgs} ${entrypoint}`, {
258262
env: {
259263
...process.env,
260-
...(noHMR ? {HMR: 'false'} : {})
264+
...(noHMR ? {HMR: 'false'} : {}),
265+
MRT_DISABLE_HTTPONLY_SESSION_COOKIES: disableHttpOnlySessionCookies
261266
}
262267
})
263268
})

packages/pwa-kit-react-sdk/src/ssr/server/react-rendering.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ const renderApp = (args) => {
365365
__CONFIG__: config,
366366
__PRELOADED_STATE__: appState,
367367
__ERROR__: error,
368+
__MRT_DISABLE_HTTPONLY_SESSION_COOKIES__: process.env.MRT_DISABLE_HTTPONLY_SESSION_COOKIES,
368369
// `window.Progressive` has a long history at Mobify and some
369370
// client-side code depends on it. Maintain its name out of tradition.
370371
Progressive: getWindowProgressive(req, res)

packages/template-retail-react-app/config/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ module.exports = {
103103
],
104104
ssrParameters: {
105105
ssrFunctionNodeVersion: '22.x',
106+
disableHttpOnlySessionCookies: true,
106107
proxyConfigs: [
107108
{
108109
host: 'kv7kzm78.api.commercecloud.salesforce.com',

0 commit comments

Comments
 (0)