Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/config-utils/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

// stub the original write function
const _write = res.write;
let body = '';
Expand Down Expand Up @@ -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] }),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
onListening(server) {
if (useProxy) {
// Dev is just a prod but SSO does not allow dev.foo.redhat.com origin
Expand Down
Loading