We are migrating a client storefront from Sitegenesis to SF Next in mulitple phases.
In config.server.ts, we can define the legacyRoutes, and the README-HYBRID-PROXY.md says Supports exact paths and React Router-style parameterized routes:.
For phase 1, we need to redirect the categories URL to SG. I want to use wildcard * to capture all subcategories URLs like '/categoryLv1/*' so that I don't need to list all subcategories URLs in the config.server.ts.
But looking at legacy-routes.client.ts > routePatternToRegex(), this function actually doesn't support it. It will generate the wildcard exactly as single character *.
function routePatternToRegex(pattern: string): RegExp {
const escaped = pattern.replace(/[.+*?^${}()|[\]\\]/g, '\\$&');
const regexPattern = escaped.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, '([^/]+)');
return new RegExp(`^${regexPattern}$`);
}
Can you please update it to support wildcard? Otherwise we need to add hundreds of exhausted URLs here instead of the top level category URL.
Thanks,
Biao
We are migrating a client storefront from Sitegenesis to SF Next in mulitple phases.
In config.server.ts, we can define the legacyRoutes, and the README-HYBRID-PROXY.md says
Supports exact paths and React Router-style parameterized routes:.For phase 1, we need to redirect the categories URL to SG. I want to use wildcard * to capture all subcategories URLs like '/categoryLv1/*' so that I don't need to list all subcategories URLs in the config.server.ts.
But looking at legacy-routes.client.ts > routePatternToRegex(), this function actually doesn't support it. It will generate the wildcard exactly as single character *.
function routePatternToRegex(pattern: string): RegExp { const escaped = pattern.replace(/[.+*?^${}()|[\]\\]/g, '\\$&'); const regexPattern = escaped.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, '([^/]+)'); return new RegExp(`^${regexPattern}$`); }Can you please update it to support wildcard? Otherwise we need to add hundreds of exhausted URLs here instead of the top level category URL.
Thanks,
Biao