@redhat-cloud-services/frontend-components-config-utilities 4.12.2 → 4.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/proxy.js +1 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redhat-cloud-services/frontend-components-config-utilities",
3
- "version": "4.12.2",
3
+ "version": "4.12.3",
4
4
  "description": "Utilities for shared config used in Red Hat Cloud Services project.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/proxy.js CHANGED
@@ -141,7 +141,6 @@ var buildLocalAppRoutes = function (localApps, defaultLocalAppHost, target) {
141
141
  var proxy = function (_a) {
142
142
  var _b = _a.env, env = _b === void 0 ? 'stage-stable' : _b, _c = _a.customProxy, customProxy = _c === void 0 ? [] : _c, routes = _a.routes, routesPath = _a.routesPath, useProxy = _a.useProxy, _d = _a.proxyURL, proxyURL = _d === void 0 ? 'http://squid.corp.redhat.com:3128' : _d, _e = _a.appUrl, appUrl = _e === void 0 ? [] : _e, publicPath = _a.publicPath, proxyVerbose = _a.proxyVerbose, _f = _a.useCloud, useCloud = _f === void 0 ? false : _f, _g = _a.target, target = _g === void 0 ? '' : _g, _h = _a.bounceProd, bounceProd = _h === void 0 ? false : _h, _j = _a.useAgent, useAgent = _j === void 0 ? true : _j, _k = _a.localApps, localApps = _k === void 0 ? process.env.LOCAL_APPS : _k, _l = _a.frontendCRDPath, frontendCRDPath = _l === void 0 ? path_1.default.resolve(process.cwd(), 'deploy/frontend.yaml') : _l;
143
143
  var frontendCrdRef = { current: undefined };
144
- var triggerReload;
145
144
  var FEOFeaturesEnabled = false;
146
145
  try {
147
146
  frontendCrdRef.current = (0, crd_check_1.readFrontendCRD)(frontendCRDPath);
@@ -159,7 +158,6 @@ var proxy = function (_a) {
159
158
  (0, fec_logger_1.default)(fec_logger_1.LogType.info, 'Frontend CRD has changed, reloading the file');
160
159
  try {
161
160
  frontendCrdRef.current = (0, crd_check_1.readFrontendCRD)(frontendCRDPath);
162
- triggerReload === null || triggerReload === void 0 ? void 0 : triggerReload();
163
161
  }
164
162
  catch (error) {
165
163
  (0, fec_logger_1.default)(fec_logger_1.LogType.error, 'Error reloading frontend CRD file', error);
@@ -217,16 +215,8 @@ var proxy = function (_a) {
217
215
  proxy.push.apply(proxy, customProxy);
218
216
  }
219
217
  if (useProxy) {
220
- proxy.push(__assign({ secure: false, changeOrigin: true, autoRewrite: true, onProxyReq: function (proxyReq, req) {
218
+ proxy.push(__assign({ secure: false, changeOrigin: true, autoRewrite: true, onProxyRes: function (proxyRes, req, res) {
221
219
  if (FEOFeaturesEnabled && frontendCrdRef.current && (0, check_outgoing_requests_1.isInterceptAbleRequest)(req.url)) {
222
- proxyReq.removeHeader('if-none-match');
223
- proxyReq.removeHeader('if-modified-since');
224
- }
225
- }, onProxyRes: function (proxyRes, req, res) {
226
- if (FEOFeaturesEnabled && frontendCrdRef.current && (0, check_outgoing_requests_1.isInterceptAbleRequest)(req.url)) {
227
- res.removeHeader('etag');
228
- res.removeHeader('last-modified');
229
- res.setHeader('cache-control', 'no-store, no-cache, must-revalidate');
230
220
  var _write_1 = res.write;
231
221
  var body_1 = '';
232
222
  proxyRes.on('data', function (chunk) {
@@ -300,14 +290,6 @@ var proxy = function (_a) {
300
290
  })));
301
291
  }
302
292
  var config = __assign(__assign({}, (proxy.length > 0 && { proxy: proxy })), { onListening: function (server) {
303
- if (FEOFeaturesEnabled) {
304
- triggerReload = function () {
305
- var _a;
306
- if ((_a = server.webSocketServer) === null || _a === void 0 ? void 0 : _a.clients) {
307
- server.sendMessage(server.webSocketServer.clients, 'content-changed');
308
- }
309
- };
310
- }
311
293
  if (useProxy) {
312
294
  var host = useProxy ? "".concat(majorEnv === 'dev' ? 'prod' : majorEnv, ".foo.redhat.com") : 'localhost';
313
295
  var origin_1 = "https://".concat(host, ":").concat(server.options.port);