From 4aad0a3de1abce6da2f0f230e6537eb53d898a36 Mon Sep 17 00:00:00 2001 From: platex-rehor-bot Date: Thu, 23 Jul 2026 09:56:22 +0000 Subject: [PATCH 1/4] fix(@redhat-cloud-services/frontend-components-config-utilities): reload nav on CRD change RHCLOUD-49555 When feoConfigEnabled is true and the user edits deploy/frontend.yaml, the chokidar watcher correctly reloads the CRD object in memory but the browser never re-fetches navigation data. Two changes fix this: 1. Add watchFiles for the CRD path so webpack-dev-server sends a live-reload signal to the browser on file change. 2. Strip ETag/Last-Modified and set Cache-Control: no-store on intercepted FEO responses so the browser cannot serve stale navigation from its HTTP cache. Also removes unused matchNavigationRequest import. --- packages/config-utils/src/proxy.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/config-utils/src/proxy.ts b/packages/config-utils/src/proxy.ts index bc23e3be2..fb292c14d 100644 --- a/packages/config-utils/src/proxy.ts +++ b/packages/config-utils/src/proxy.ts @@ -7,7 +7,7 @@ import type { Configuration } from 'webpack-dev-server'; import { HttpsProxyAgent } from 'https-proxy-agent'; import chokidar from 'chokidar'; import cookieTransform from './cookieTransform'; -import { isInterceptAbleRequest, matchNavigationRequest } from './feo/check-outgoing-requests'; +import { isInterceptAbleRequest } from './feo/check-outgoing-requests'; import { hasFEOFeaturesEnabled, readFrontendCRD } from './feo/crd-check'; import fecLogger, { LogType } from './fec-logger'; import { modifyRequest } from './feo/modify-response'; @@ -243,6 +243,12 @@ const proxy = ({ // The functionality is disabled until the interceptor is ready if (FEOFeaturesEnabled && frontendCrdRef.current && isInterceptAbleRequest(req.url)) { + // Prevent browser from caching intercepted responses so that + // CRD changes are reflected on page reload without stale data + res.removeHeader('etag'); + res.removeHeader('last-modified'); + res.setHeader('cache-control', 'no-store, no-cache, must-revalidate'); + // stub the original write function const _write = res.write; let body = ''; @@ -333,6 +339,11 @@ const proxy = ({ const config: Configuration = { ...(proxy.length > 0 && { proxy }), + // Watch the frontend CRD file so webpack-dev-server triggers a full + // page reload when it changes. The chokidar watcher above updates + // frontendCrdRef.current in memory; this ensures the browser + // re-fetches navigation data with the updated CRD. + ...(FEOFeaturesEnabled && { watchFiles: [frontendCRDPath] }), onListening(server) { if (useProxy) { // Dev is just a prod but SSO does not allow dev.foo.redhat.com origin From 1e8e37d8b3ff44c6e4c765e9dca9c128841712da Mon Sep 17 00:00:00 2001 From: platex-rehor-bot Date: Thu, 23 Jul 2026 10:06:07 +0000 Subject: [PATCH 2/4] fix(@redhat-cloud-services/frontend-components-config-utilities): prevent stale CRD responses RHCLOUD-49555 Strip If-None-Match and If-Modified-Since request headers on intercepted FEO responses so upstream 304s cannot bypass CRD content modifications. Replace independent watchFiles reload with a coordinated trigger from the chokidar CRD watcher, ensuring the browser only reloads after the in-memory CRD has been updated. Co-Authored-By: Claude Opus 4.6 --- packages/config-utils/src/proxy.ts | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/packages/config-utils/src/proxy.ts b/packages/config-utils/src/proxy.ts index fb292c14d..44d249ea0 100644 --- a/packages/config-utils/src/proxy.ts +++ b/packages/config-utils/src/proxy.ts @@ -136,6 +136,8 @@ const proxy = ({ frontendCRDPath = path.resolve(process.cwd(), 'deploy/frontend.yaml'), }: ProxyOptions) => { const frontendCrdRef: { current?: FrontendCRD } = { current: undefined }; + // Callback set by onListening to trigger browser reload from the CRD watcher + let triggerReload: (() => void) | undefined; let FEOFeaturesEnabled = false; try { frontendCrdRef.current = readFrontendCRD(frontendCRDPath); @@ -156,6 +158,10 @@ const proxy = ({ fecLogger(LogType.info, 'Frontend CRD has changed, reloading the file'); try { frontendCrdRef.current = readFrontendCRD(frontendCRDPath); + // Trigger browser reload AFTER the in-memory CRD is updated so that + // subsequent requests read the new navigation data (avoids race with + // an independent watchFiles trigger). + triggerReload?.(); } catch (error) { fecLogger(LogType.error, 'Error reloading frontend CRD file', error); } @@ -238,6 +244,14 @@ const proxy = ({ secure: false, changeOrigin: true, autoRewrite: true, + onProxyReq: (proxyReq, req) => { + // Strip conditional request headers for intercepted FEO responses to + // prevent 304 responses that would bypass CRD content modifications + if (FEOFeaturesEnabled && frontendCrdRef.current && isInterceptAbleRequest(req.url)) { + proxyReq.removeHeader('if-none-match'); + proxyReq.removeHeader('if-modified-since'); + } + }, onProxyRes: (proxyRes, req, res) => { // this should reading the aggregated bundles filed generated from chrome service // The functionality is disabled until the interceptor is ready @@ -339,12 +353,16 @@ const proxy = ({ const config: Configuration = { ...(proxy.length > 0 && { proxy }), - // Watch the frontend CRD file so webpack-dev-server triggers a full - // page reload when it changes. The chokidar watcher above updates - // frontendCrdRef.current in memory; this ensures the browser - // re-fetches navigation data with the updated CRD. - ...(FEOFeaturesEnabled && { watchFiles: [frontendCRDPath] }), onListening(server) { + // Provide reload trigger to the CRD chokidar watcher so it can + // refresh the browser AFTER the in-memory CRD has been updated. + if (FEOFeaturesEnabled) { + triggerReload = () => { + if (server.webSocketServer?.clients) { + server.sendMessage(server.webSocketServer.clients, 'content-changed'); + } + }; + } if (useProxy) { // Dev is just a prod but SSO does not allow dev.foo.redhat.com origin const host = useProxy ? `${majorEnv === 'dev' ? 'prod' : majorEnv}.foo.redhat.com` : 'localhost'; From 2dca5ade0a874b97ce1ba9c646bb9cdbf1447112 Mon Sep 17 00:00:00 2001 From: platex-rehor-bot Date: Thu, 23 Jul 2026 11:27:33 +0000 Subject: [PATCH 3/4] feat(@redhat-cloud-services/frontend-components-config): add CRD interception to dev-proxy mode RHCLOUD-49555 When feoConfigEnabled is true, fec dev-proxy now starts a CRD interceptor server that proxies the 4 chrome-service API endpoints through a local Node server which applies modifyRequest() to inject local frontend.yaml changes. This brings CRD interception parity between fec dev and fec dev-proxy, reusing 100% of the existing interception code from config-utils. Co-Authored-By: Claude Opus 4.6 --- .../config/src/bin/crd-interceptor-server.ts | 192 ++++++++++++++++++ packages/config/src/bin/dev-proxy-script.ts | 38 +++- 2 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 packages/config/src/bin/crd-interceptor-server.ts diff --git a/packages/config/src/bin/crd-interceptor-server.ts b/packages/config/src/bin/crd-interceptor-server.ts new file mode 100644 index 000000000..ccfe68fdb --- /dev/null +++ b/packages/config/src/bin/crd-interceptor-server.ts @@ -0,0 +1,192 @@ +import http from 'http'; +import https from 'https'; +import { URL } from 'url'; +import chokidar from 'chokidar'; +import { HttpsProxyAgent } from 'https-proxy-agent'; +import { readFrontendCRD } from '@redhat-cloud-services/frontend-components-config-utilities/feo/crd-check'; +import { FrontendCRD } from '@redhat-cloud-services/frontend-components-config-utilities/feo/feo-types'; +import { modifyRequest } from '@redhat-cloud-services/frontend-components-config-utilities/feo/modify-response'; +import { LogType, fecLogger } from '@redhat-cloud-services/frontend-components-config-utilities'; + +const PROXY_URL = 'http://squid.corp.redhat.com:3128'; + +export const CRD_INTERCEPTOR_PORT = 9997; + +/** + * The 4 chrome-service API endpoints that need CRD interception. + * These are the same URLs matched by isInterceptAbleRequest() in config-utils. + */ +export const INTERCEPTABLE_PATHS = [ + '/api/chrome-service/v1/static/bundles-generated.json', + '/api/chrome-service/v1/static/search-index-generated.json', + '/api/chrome-service/v1/static/service-tiles-generated.json', + '/api/chrome-service/v1/static/fed-modules-generated.json', +]; + +interface CRDInterceptorOptions { + frontendCRDPath: string; + port?: number; + debug?: boolean; +} + +/** + * Starts a Node HTTP server that intercepts chrome-service API responses + * and applies local CRD modifications via modifyRequest(). + * + * This brings CRD interception support to `fec dev-proxy` mode, where the + * Caddy container normally proxies /api/* directly to stage without any + * local CRD awareness. The Caddy routes config directs the 4 interceptable + * API paths to this server instead, which fetches from upstream, applies + * CRD modifications, and returns the modified response. + * + * Reuses 100% of the existing interception code from config-utils: + * navigationInterceptor, searchInterceptor, moduleInterceptor, + * serviceTilesInterceptor (via modifyRequest). + */ +export async function startCRDInterceptorServer(options: CRDInterceptorOptions): Promise { + const { frontendCRDPath, port = CRD_INTERCEPTOR_PORT, debug = false } = options; + + const log = (logType: LogType, ...data: any[]) => { + if (logType === LogType.debug && !debug) return; + fecLogger(logType, ...data); + }; + + // Read and watch the CRD file, same pattern as proxy.ts + const frontendCrdRef: { current?: FrontendCRD } = { current: undefined }; + try { + frontendCrdRef.current = readFrontendCRD(frontendCRDPath); + } catch (e) { + log(LogType.warn, `CRD interceptor: Unable to read frontend CRD at ${frontendCRDPath}`); + } + + const watcher = chokidar.watch(frontendCRDPath).on('change', () => { + log(LogType.info, 'CRD interceptor: Frontend CRD changed, reloading'); + try { + frontendCrdRef.current = readFrontendCRD(frontendCRDPath); + } catch (error) { + log(LogType.error, 'CRD interceptor: Error reloading CRD', error); + } + }); + + const hccEnvUrl = process.env.HCC_ENV_URL!; + const isStage = process.env.HCC_ENV === 'stage'; + const agent = isStage ? new HttpsProxyAgent(PROXY_URL) : undefined; + + const server = http.createServer((req, res) => { + const url = req.url || '/'; + + if (!frontendCrdRef.current) { + log(LogType.warn, `CRD interceptor: No CRD loaded, proxying ${url} without modification`); + proxyPassthrough(url, req, res, hccEnvUrl, agent, log); + return; + } + + // Proxy to upstream (always HTTPS for HCC environments) and apply + // CRD modifications to the response + const upstreamUrl = new URL(url, hccEnvUrl); + + const headers: Record = { + ...req.headers, + host: upstreamUrl.hostname, + }; + // Prevent 304 responses that would bypass content modification + delete headers['if-none-match']; + delete headers['if-modified-since']; + + const proxyReq = https.request( + { + hostname: upstreamUrl.hostname, + port: upstreamUrl.port || 443, + path: upstreamUrl.pathname + upstreamUrl.search, + method: req.method, + headers, + // HttpsProxyAgent v5 extends agent-base Agent, not https.Agent, + // but is fully compatible at runtime + agent: agent as https.Agent | undefined, + }, + (proxyRes) => { + let body = ''; + proxyRes.on('data', (chunk: Buffer) => { + body += chunk.toString(); + }); + proxyRes.on('end', () => { + try { + const modified = modifyRequest(body, url, frontendCrdRef.current!); + res.writeHead(200, { + 'content-type': 'application/json', + 'content-length': Buffer.byteLength(modified), + 'cache-control': 'no-store, no-cache, must-revalidate', + }); + res.end(modified); + log(LogType.debug, `CRD interceptor: Modified response for ${url}`); + } catch (error) { + log(LogType.error, `CRD interceptor: Error modifying response for ${url}`, error); + res.writeHead(proxyRes.statusCode || 500, { + 'content-type': proxyRes.headers['content-type'] || 'application/json', + }); + res.end(body); + } + }); + }, + ); + + proxyReq.on('error', (error) => { + log(LogType.error, `CRD interceptor: Upstream request failed for ${url}`, error); + res.writeHead(502, { 'content-type': 'application/json' }); + res.end(JSON.stringify({ error: 'Upstream request failed' })); + }); + + req.pipe(proxyReq); + }); + + const cleanup = () => { + watcher.close(); + }; + + process.on('SIGTERM', cleanup); + process.on('SIGINT', cleanup); + + return new Promise((resolve, reject) => { + server.listen(port, () => { + log(LogType.info, `CRD interceptor server listening on port ${port}`); + resolve(server); + }); + server.on('error', reject); + }); +} + +function proxyPassthrough( + url: string, + req: http.IncomingMessage, + res: http.ServerResponse, + hccEnvUrl: string, + agent: HttpsProxyAgent | undefined, + log: (logType: LogType, ...data: any[]) => void, +) { + const upstreamUrl = new URL(url, hccEnvUrl); + + const proxyReq = https.request( + { + hostname: upstreamUrl.hostname, + port: upstreamUrl.port || 443, + path: upstreamUrl.pathname + upstreamUrl.search, + method: req.method, + headers: { ...req.headers, host: upstreamUrl.hostname }, + agent: agent as https.Agent | undefined, + }, + (proxyRes) => { + res.writeHead(proxyRes.statusCode || 200, proxyRes.headers); + proxyRes.pipe(res); + }, + ); + + proxyReq.on('error', (error) => { + log(LogType.error, `CRD interceptor: Passthrough request failed for ${url}`, error); + res.writeHead(502); + res.end('Upstream error'); + }); + + req.pipe(proxyReq); +} + +export default startCRDInterceptorServer; diff --git a/packages/config/src/bin/dev-proxy-script.ts b/packages/config/src/bin/dev-proxy-script.ts index 4afec2b10..84ca6782e 100644 --- a/packages/config/src/bin/dev-proxy-script.ts +++ b/packages/config/src/bin/dev-proxy-script.ts @@ -5,7 +5,9 @@ import os from 'os'; import path from 'path'; import treeKill from 'tree-kill'; import { LogType, fecLogger as fecLoggerDefault } from '@redhat-cloud-services/frontend-components-config-utilities'; +import { hasFEOFeaturesEnabled, readFrontendCRD } from '@redhat-cloud-services/frontend-components-config-utilities/feo/crd-check'; import { getCdnPath, setEnv, validateFECConfig } from './common'; +import startCRDInterceptorServer, { CRD_INTERCEPTOR_PORT, INTERCEPTABLE_PATHS } from './crd-interceptor-server'; import serveChrome, { CONTAINER_NAME as CHROME_CONTAINTER_NAME, ContainerRuntime, checkContainerRuntime } from './serve-chrome'; const PROXY_URL = 'http://squid.corp.redhat.com:3128'; @@ -82,7 +84,7 @@ function pullImage(containerName: string, repo: string, tag: string) { execSync(`${execBin} pull ${repo}:${tag}`, debug ? { stdio: 'inherit' } : { stdio: [] }); } -function createRoutesConfig(fecConfig: any, cdnPath: string, port: string, SPAFallback: boolean, filename: string = 'routes.json'): string { +function createRoutesConfig(fecConfig: any, cdnPath: string, port: string, SPAFallback: boolean, filename: string = 'routes.json', interceptorPort?: number): string { let routes: Map = new Map(); let fecRoutes = fecConfig?.routes || undefined; @@ -130,6 +132,14 @@ function createRoutesConfig(fecConfig: any, cdnPath: string, port: string, SPAFa } }); + // Add CRD interceptor routes so Caddy directs chrome-service API + // requests to the local interceptor instead of straight to stage + if (interceptorPort) { + INTERCEPTABLE_PATHS.forEach((interceptPath) => { + routes.set(interceptPath, { url: `${DEFAULT_LOCAL_ROUTE}:${interceptorPort}` }); + }); + } + const tempDir = os.tmpdir(); const tempFilePath = path.join(tempDir, filename); const jsonContent = JSON.stringify(Object.fromEntries(routes)); @@ -217,6 +227,27 @@ async function devProxyScript( process.exit(1); } + // Check if FEO features are enabled and start CRD interceptor server + // so that dev-proxy mode can apply local CRD changes to chrome-service + // API responses (navigation, search, modules, service tiles) + let interceptorPort: number | undefined; + let interceptorServer: import('http').Server | undefined; + const frontendCRDPath = fecConfig.frontendCRDPath ?? path.resolve(cwd, 'deploy/frontend.yaml'); + try { + const crd = readFrontendCRD(frontendCRDPath); + if (hasFEOFeaturesEnabled(crd)) { + fecLogger(LogType.info, 'FEO features enabled, starting CRD interceptor server for dev-proxy mode'); + interceptorServer = await startCRDInterceptorServer({ + frontendCRDPath, + port: CRD_INTERCEPTOR_PORT, + debug, + }); + interceptorPort = CRD_INTERCEPTOR_PORT; + } + } catch (e) { + fecLogger(LogType.debug, 'FEO features not available for CRD interception in dev-proxy mode'); + } + try { fs.statSync(webpackConfigPath); webpackConfig = require(webpackConfigPath); @@ -235,7 +266,7 @@ async function devProxyScript( const staticPort = argv.staticPort ?? '8003'; try { cdnPath = getCdnPath(fecConfig, webpackConfig, cwd); - routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback); + routesConfigPath = createRoutesConfig(fecConfig, cdnPath, staticPort, SPAFallback, 'routes.json', interceptorPort); } catch (error) { fecLogger(LogType.error, 'Failed to generate the proxy routes config:', error); process.exit(1); @@ -264,6 +295,9 @@ async function devProxyScript( if (waitOnProcess?.pid) { treeKill(waitOnProcess.pid, 'SIGKILL'); } + if (interceptorServer) { + interceptorServer.close(); + } stopContainer(DEV_PROXY_CONTAINER_NAME); if (SPAFallback) { stopContainer(CHROME_CONTAINTER_NAME); From 282c2cd0d87b327503dc429c44de7c3c409a0347 Mon Sep 17 00:00:00 2001 From: platex-rehor-bot Date: Thu, 23 Jul 2026 11:43:05 +0000 Subject: [PATCH 4/4] fix(@redhat-cloud-services/frontend-components-config): harden CRD interceptor RHCLOUD-49555 Address CodeRabbit review: bind to 127.0.0.1, validate interceptable paths, add request timeouts, chokidar error handler, unknown[] types, separate error handling for interceptor startup failures. Fix prettier formatting for createRoutesConfig params. --- .../config/src/bin/crd-interceptor-server.ts | 44 ++++++++++++++----- packages/config/src/bin/dev-proxy-script.ts | 25 ++++++++--- 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/packages/config/src/bin/crd-interceptor-server.ts b/packages/config/src/bin/crd-interceptor-server.ts index ccfe68fdb..b10a73a8c 100644 --- a/packages/config/src/bin/crd-interceptor-server.ts +++ b/packages/config/src/bin/crd-interceptor-server.ts @@ -46,7 +46,7 @@ interface CRDInterceptorOptions { export async function startCRDInterceptorServer(options: CRDInterceptorOptions): Promise { const { frontendCRDPath, port = CRD_INTERCEPTOR_PORT, debug = false } = options; - const log = (logType: LogType, ...data: any[]) => { + const log = (logType: LogType, ...data: unknown[]) => { if (logType === LogType.debug && !debug) return; fecLogger(logType, ...data); }; @@ -59,14 +59,17 @@ export async function startCRDInterceptorServer(options: CRDInterceptorOptions): log(LogType.warn, `CRD interceptor: Unable to read frontend CRD at ${frontendCRDPath}`); } - const watcher = chokidar.watch(frontendCRDPath).on('change', () => { - log(LogType.info, 'CRD interceptor: Frontend CRD changed, reloading'); - try { - frontendCrdRef.current = readFrontendCRD(frontendCRDPath); - } catch (error) { - log(LogType.error, 'CRD interceptor: Error reloading CRD', error); - } - }); + const watcher = chokidar + .watch(frontendCRDPath) + .on('error', (error) => log(LogType.error, 'CRD interceptor: Watcher error', error)) + .on('change', () => { + log(LogType.info, 'CRD interceptor: Frontend CRD changed, reloading'); + try { + frontendCrdRef.current = readFrontendCRD(frontendCRDPath); + } catch (error) { + log(LogType.error, 'CRD interceptor: Error reloading CRD', error); + } + }); const hccEnvUrl = process.env.HCC_ENV_URL!; const isStage = process.env.HCC_ENV === 'stage'; @@ -75,6 +78,19 @@ export async function startCRDInterceptorServer(options: CRDInterceptorOptions): const server = http.createServer((req, res) => { const url = req.url || '/'; + // Reject absolute URLs and non-interceptable paths + if (url.startsWith('//') || url.startsWith('http')) { + res.writeHead(400, { 'content-type': 'application/json' }); + res.end(JSON.stringify({ error: 'Absolute URLs not allowed' })); + return; + } + const pathname = url.split('?')[0]; + if (!INTERCEPTABLE_PATHS.includes(pathname)) { + res.writeHead(404, { 'content-type': 'application/json' }); + res.end(JSON.stringify({ error: 'Path not interceptable' })); + return; + } + if (!frontendCrdRef.current) { log(LogType.warn, `CRD interceptor: No CRD loaded, proxying ${url} without modification`); proxyPassthrough(url, req, res, hccEnvUrl, agent, log); @@ -103,6 +119,7 @@ export async function startCRDInterceptorServer(options: CRDInterceptorOptions): // HttpsProxyAgent v5 extends agent-base Agent, not https.Agent, // but is fully compatible at runtime agent: agent as https.Agent | undefined, + timeout: 15000, }, (proxyRes) => { let body = ''; @@ -130,6 +147,7 @@ export async function startCRDInterceptorServer(options: CRDInterceptorOptions): }, ); + proxyReq.on('timeout', () => proxyReq.destroy(new Error('Upstream request timed out'))); proxyReq.on('error', (error) => { log(LogType.error, `CRD interceptor: Upstream request failed for ${url}`, error); res.writeHead(502, { 'content-type': 'application/json' }); @@ -147,8 +165,8 @@ export async function startCRDInterceptorServer(options: CRDInterceptorOptions): process.on('SIGINT', cleanup); return new Promise((resolve, reject) => { - server.listen(port, () => { - log(LogType.info, `CRD interceptor server listening on port ${port}`); + server.listen(port, '127.0.0.1', () => { + log(LogType.info, `CRD interceptor server listening on 127.0.0.1:${port}`); resolve(server); }); server.on('error', reject); @@ -161,7 +179,7 @@ function proxyPassthrough( res: http.ServerResponse, hccEnvUrl: string, agent: HttpsProxyAgent | undefined, - log: (logType: LogType, ...data: any[]) => void, + log: (logType: LogType, ...data: unknown[]) => void, ) { const upstreamUrl = new URL(url, hccEnvUrl); @@ -173,6 +191,7 @@ function proxyPassthrough( method: req.method, headers: { ...req.headers, host: upstreamUrl.hostname }, agent: agent as https.Agent | undefined, + timeout: 15000, }, (proxyRes) => { res.writeHead(proxyRes.statusCode || 200, proxyRes.headers); @@ -180,6 +199,7 @@ function proxyPassthrough( }, ); + proxyReq.on('timeout', () => proxyReq.destroy(new Error('Upstream request timed out'))); proxyReq.on('error', (error) => { log(LogType.error, `CRD interceptor: Passthrough request failed for ${url}`, error); res.writeHead(502); diff --git a/packages/config/src/bin/dev-proxy-script.ts b/packages/config/src/bin/dev-proxy-script.ts index 84ca6782e..706ca2aa0 100644 --- a/packages/config/src/bin/dev-proxy-script.ts +++ b/packages/config/src/bin/dev-proxy-script.ts @@ -84,7 +84,14 @@ function pullImage(containerName: string, repo: string, tag: string) { execSync(`${execBin} pull ${repo}:${tag}`, debug ? { stdio: 'inherit' } : { stdio: [] }); } -function createRoutesConfig(fecConfig: any, cdnPath: string, port: string, SPAFallback: boolean, filename: string = 'routes.json', interceptorPort?: number): string { +function createRoutesConfig( + fecConfig: any, + cdnPath: string, + port: string, + SPAFallback: boolean, + filename: string = 'routes.json', + interceptorPort?: number, +): string { let routes: Map = new Map(); let fecRoutes = fecConfig?.routes || undefined; @@ -237,12 +244,16 @@ async function devProxyScript( const crd = readFrontendCRD(frontendCRDPath); if (hasFEOFeaturesEnabled(crd)) { fecLogger(LogType.info, 'FEO features enabled, starting CRD interceptor server for dev-proxy mode'); - interceptorServer = await startCRDInterceptorServer({ - frontendCRDPath, - port: CRD_INTERCEPTOR_PORT, - debug, - }); - interceptorPort = CRD_INTERCEPTOR_PORT; + try { + interceptorServer = await startCRDInterceptorServer({ + frontendCRDPath, + port: CRD_INTERCEPTOR_PORT, + debug, + }); + interceptorPort = CRD_INTERCEPTOR_PORT; + } catch (interceptorError) { + fecLogger(LogType.error, 'FEO is enabled but the CRD interceptor server failed to start:', interceptorError); + } } } catch (e) { fecLogger(LogType.debug, 'FEO features not available for CRD interception in dev-proxy mode');