-
Notifications
You must be signed in to change notification settings - Fork 214
@W-19869537 Added Hybrid Proxy support for local and ODS hybrid development when no eCDN available #3409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@W-19869537 Added Hybrid Proxy support for local and ODS hybrid development when no eCDN available #3409
Changes from 20 commits
162f1d5
747ef72
ad65562
499066a
953719d
6d0a761
3cf8e55
5b4455a
b4db448
baa6709
dd7e236
b484e92
f5698b1
f12eb6a
db27ead
bc54ed0
04bf75a
46aefd8
401792c
7d553fa
c0e0e18
ab622b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,54 @@ const options = { | |
| // of the keys of headers that have been encoded | ||
| // There may be a slight performance loss with requests/responses with large number | ||
| // of headers as we loop through all the headers to verify ASCII vs non ASCII | ||
| encodeNonAsciiHttpHeaders: true | ||
| encodeNonAsciiHttpHeaders: true, | ||
|
|
||
| // Cookie handling configuration for security and session management. | ||
| // | ||
| // SECURITY CONSIDERATIONS: | ||
| // - Set to 'false' in production for enhanced security (prevents XSS attacks via client-side cookie access) | ||
| // - Set to 'true' only in development when testing SFCC session integration or Hybrid Proxy functionality | ||
| // - When false: cookies are stripped from requests and cannot be set in responses (server-only cookies) | ||
| // - When true: allows client-side JavaScript access to cookies (development/testing only) | ||
| // | ||
| // HYBRID PROXY REQUIREMENT: | ||
| // - Hybrid Proxy requires this to be 'true' for SFCC session management to work properly | ||
| // - Only enable Hybrid Proxy in development environments, never in production | ||
| localAllowCookies: false, | ||
|
|
||
| // Hybrid Proxy configuration for local development and MRT to ODS connection testing. | ||
| // | ||
| // IMPORTANT SECURITY NOTES: | ||
| // - This should ONLY be used for local development and testing | ||
| // - NEVER enable in production - use eCDN rules instead for production routing | ||
| // - When enabled, localAllowCookies must be set to 'true' for SFCC sessions to work | ||
| // - Production deployments should use eCDN to direct requests to SFCC instances | ||
| // | ||
| // REFERENCE: https://developer.salesforce.com/docs/commerce/commerce-api/guide/hybrid-authentication.html | ||
| hybridProxy: { | ||
| // If this is enabled, the Hybrid Proxy will be enabled to proxy requests to the SFCC instance. | ||
| // IMPORTANT: This should only be used for local development. For production, this should be disabled and use eCDN to direct requests to the SFCC instance. | ||
| // Refer to https://developer.salesforce.com/docs/commerce/commerce-api/guide/hybrid-authentication.html for more details. | ||
| enabled: false, | ||
|
|
||
| // The origin of the SFCC instance (i.e. the instance that is being proxied to which hosts the storefront). | ||
| sfccOrigin: 'https://{{answers.project.commerce.instanceUrl}}', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use {{answers.project.commerce.instanceUrl}} so that user does not need to update this manually in ssr.js |
||
|
|
||
| // The MRT rules to apply to the hybrid proxy. | ||
| // These rules determine which requests are handled by PWA Kit (MRT) vs proxied to SFCC. The same rules should be used in the eCDN rules for the same requests. | ||
| // Paths excluded from the rules will be re-directed to SFCC instance. In the following example, the Cart and checkout pages are excluded from the rules. | ||
| // Refer to the following links for more details: | ||
| // * https://developer.salesforce.com/docs/commerce/commerce-api/references/cdn-api-process-apis?meta=MrtRules | ||
| // * https://developer.salesforce.com/docs/commerce/commerce-api/guide/ecdn-rules-for-phased-headless-rollout.html | ||
| routingRules: [ | ||
| // Hybrid Proxy Routing Rules | ||
| // Purpose: Route requests between PWA Kit (React) and SFCC (traditional storefront) | ||
| // Configuration: site: 'none', locale: 'none' → URLs like /category/womens (no prefixes) | ||
| // Logic: URLs matching these patterns → PWA Kit handles them | ||
| // URLs NOT matching → proxied to SFCC (e.g., /cart, /checkout) | ||
| 'http.request.uri.path eq "/" or http.request.uri.path matches "^/callback" or http.request.uri.path matches "^/mobify" or http.request.uri.path matches "^/worker.js" or http.request.uri.path matches "^/login" or http.request.uri.path matches "^/reset-password" or http.request.uri.path matches "^/registration" or http.request.uri.path matches "^/account" or http.request.uri.path matches "^/account/orders" or http.request.uri.path matches "^/account/orders/(\\\\w+)" or http.request.uri.path matches "^/account/wishlist" or http.request.uri.path matches "^/product/(\\\\w+)" or http.request.uri.path matches "^/search" or http.request.uri.path matches "^/category/(\\\\w+)" or http.request.uri.path matches "^/store-locator" or http.request.uri.path matches "^/social-callback" or http.request.uri.path matches "^/passwordless-login-callback" or http.request.uri.path matches "^/passwordless-login-landing" or http.request.uri.path matches "^/reset-password-callback" or http.request.uri.path matches "^/reset-password-landing"' | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| const runtime = getRuntime() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,54 @@ const options = { | |
| // of the keys of headers that have been encoded | ||
| // There may be a slight performance loss with requests/responses with large number | ||
| // of headers as we loop through all the headers to verify ASCII vs non ASCII | ||
| encodeNonAsciiHttpHeaders: true | ||
| encodeNonAsciiHttpHeaders: true, | ||
|
|
||
| // Cookie handling configuration for security and session management. | ||
| // | ||
| // SECURITY CONSIDERATIONS: | ||
| // - Set to 'false' in production for enhanced security (prevents XSS attacks via client-side cookie access) | ||
| // - Set to 'true' only in development when testing SFCC session integration or Hybrid Proxy functionality | ||
| // - When false: cookies are stripped from requests and cannot be set in responses (server-only cookies) | ||
| // - When true: allows client-side JavaScript access to cookies (development/testing only) | ||
| // | ||
| // HYBRID PROXY REQUIREMENT: | ||
| // - Hybrid Proxy requires this to be 'true' for SFCC session management to work properly | ||
| // - Only enable Hybrid Proxy in development environments, never in production | ||
| localAllowCookies: false, | ||
|
|
||
| // Hybrid Proxy configuration for local development and MRT to ODS connection testing. | ||
| // | ||
| // IMPORTANT SECURITY NOTES: | ||
| // - This should ONLY be used for local development and testing | ||
| // - NEVER enable in production - use eCDN rules instead for production routing | ||
| // - When enabled, localAllowCookies must be set to 'true' for SFCC sessions to work | ||
| // - Production deployments should use eCDN to direct requests to SFCC instances | ||
| // | ||
| // REFERENCE: https://developer.salesforce.com/docs/commerce/commerce-api/guide/hybrid-authentication.html | ||
| hybridProxy: { | ||
| // If this is enabled, the Hybrid Proxy will be enabled to proxy requests to the SFCC instance. | ||
| // IMPORTANT: This should only be used for local development. For production, this should be disabled and use eCDN to direct requests to the SFCC instance. | ||
| // Refer to https://developer.salesforce.com/docs/commerce/commerce-api/guide/hybrid-authentication.html for more details. | ||
| enabled: false, | ||
|
|
||
| // The origin of the SFCC instance (i.e. the instance that is being proxied to which hosts the storefront). | ||
| sfccOrigin: 'https://{{answers.project.commerce.instanceUrl}}', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use {{answers.project.commerce.instanceUrl}} so that user does not need to update this manually in ssr.js |
||
|
|
||
| // The MRT rules to apply to the hybrid proxy. | ||
| // These rules determine which requests are handled by PWA Kit (MRT) vs proxied to SFCC. The same rules should be used in the eCDN rules for the same requests. | ||
| // Paths excluded from the rules will be re-directed to SFCC instance. In the following example, the Cart and checkout pages are excluded from the rules. | ||
| // Refer to the following links for more details: | ||
| // * https://developer.salesforce.com/docs/commerce/commerce-api/references/cdn-api-process-apis?meta=MrtRules | ||
| // * https://developer.salesforce.com/docs/commerce/commerce-api/guide/ecdn-rules-for-phased-headless-rollout.html | ||
| routingRules: [ | ||
| // Hybrid Proxy Routing Rules | ||
| // Purpose: Route requests between PWA Kit (React) and SFCC (traditional storefront) | ||
| // Configuration: site: 'none', locale: 'none' → URLs like /category/womens (no prefixes) | ||
| // Logic: URLs matching these patterns → PWA Kit handles them | ||
| // URLs NOT matching → proxied to SFCC (e.g., /cart, /checkout) | ||
| 'http.request.uri.path eq "/" or http.request.uri.path matches "^/callback" or http.request.uri.path matches "^/mobify" or http.request.uri.path matches "^/worker.js" or http.request.uri.path matches "^/login" or http.request.uri.path matches "^/reset-password" or http.request.uri.path matches "^/registration" or http.request.uri.path matches "^/account" or http.request.uri.path matches "^/account/orders" or http.request.uri.path matches "^/account/orders/(\\\\w+)" or http.request.uri.path matches "^/account/wishlist" or http.request.uri.path matches "^/product/(\\\\w+)" or http.request.uri.path matches "^/search" or http.request.uri.path matches "^/category/(\\\\w+)" or http.request.uri.path matches "^/store-locator" or http.request.uri.path matches "^/social-callback" or http.request.uri.path matches "^/passwordless-login-callback" or http.request.uri.path matches "^/passwordless-login-landing" or http.request.uri.path matches "^/reset-password-callback" or http.request.uri.path matches "^/reset-password-landing"' | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| const runtime = getRuntime() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe not this PR directly, but why are there two v3.14.0-dev sections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @patricksullivansf. It must be the auto merge. I fixed it.