-
Notifications
You must be signed in to change notification settings - Fork 199
@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
base: develop
Are you sure you want to change the base?
Conversation
- Resolved merge conflicts in pwa-kit-mcp package - Added new tools: hooks-recommendation and explore-scapi-shop-api - Updated CHANGELOG.md and README.md with new features - Merged changes from develop branch including new MCP tools and utilities
* Hybrid CDN 1st pass --------- Signed-off-by: Aditya Tekur <[email protected]>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
const isString = (element) => typeof element === 'string' | ||
const isArray = (element) => Array.isArray(element) | ||
const isObject = (element) => element && typeof element === 'object' | ||
const isIterable = (element) => isArray(element) || isObject(element) | ||
|
||
const forEachIn = (iterable, functionRef) => { | ||
Object.keys(iterable).forEach((key) => { | ||
functionRef(key, iterable[key]) | ||
}) | ||
} |
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.
These appear to be generic util functions. Do they need to be a part of hybridProxy.js ?
enabled: false, | ||
|
||
// The origin of the SFCC instance (i.e. the instance that is being proxied to which hosts the storefront). | ||
sfccOrigin: 'https://zzrf-001.dx.commercecloud.salesforce.com', |
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.
Did we consider reading this from config/env instead of hard-coding the hostname ?
// * 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: [ | ||
'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 "^/(\\\\w+)/([-\\\\w]+)/$" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/login" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/reset-password" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/registration" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/account" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/account/orders" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/account/orders/(\\\\w+)" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/account/wishlist" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/product/(\\\\w+)" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/search" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/category/(\\\\w+)" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/order-status" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/page/(\\\\w+)" or http.request.uri.path matches "^/(\\\\w+)/([-\\\\w]+)/page-viewer/(\\\\w+)"' |
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.
Same here. Can we avoid hard-coding the routing rules and make them configurable via env var ?
// 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, |
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.
I see the steps to test require updates to config/default.js:
I don't see corresponding code changes to Also for the config consider naming: |
Description
Overview
This PR introduces Hybrid Proxy support for PWA Kit, enabling seamless integration between PWA Kit applications and Salesforce Commerce Cloud (SFCC) instances during local development and ODS hybrid scenarios when no eCDN is available.
🎯 Key Changes
A pwa-kit storefront with hybrid proxy enabled is deployed on MRT and connected to ODS for testing.
Types of Changes
Changes
How to Test-Drive This PR
Steps to test:
Uncomment hybridAuthEnabled in _app-config.js
Update routes.jsx to exclude routes on the PWA-Kit. Reference this code
Update default.js
{
host: [your SFCC store],
path: 'dwrestatic'
}
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization