@redhat-cloud-services/frontend-components-config-utilities 1.5.18 → 1.5.19
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.
- package/package.json +1 -1
- package/proxy.js +7 -3
package/package.json
CHANGED
package/proxy.js
CHANGED
|
@@ -60,6 +60,8 @@ module.exports = ({
|
|
|
60
60
|
const isProd = env.startsWith('prod');
|
|
61
61
|
const isStage = env.startsWith('stage');
|
|
62
62
|
|
|
63
|
+
const shouldBounceProdRequests = isProd && bounceProd && !useAgent;
|
|
64
|
+
|
|
63
65
|
if (isStage || (isProd && useAgent)) {
|
|
64
66
|
// stage is deployed with Akamai which requires a corporate proxy
|
|
65
67
|
agent = new HttpsProxyAgent(proxyURL);
|
|
@@ -205,7 +207,7 @@ module.exports = ({
|
|
|
205
207
|
* Use node-fetch to proxy all non-GET requests (this avoids all origin/host akamai policy)
|
|
206
208
|
* This enables using PROD proxy without VPN and agent
|
|
207
209
|
*/
|
|
208
|
-
if (
|
|
210
|
+
if (shouldBounceProdRequests && req.method !== 'GET') {
|
|
209
211
|
const result = await fetch((target + req.url).replace(/\/\//g, '/'), {
|
|
210
212
|
method: req.method,
|
|
211
213
|
body: JSON.stringify(req.body),
|
|
@@ -261,8 +263,10 @@ module.exports = ({
|
|
|
261
263
|
onBeforeSetupMiddleware({ app, compiler, options }) {
|
|
262
264
|
app.enable('strict routing'); // trailing slashes are mean
|
|
263
265
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
+
if (shouldBounceProdRequests) {
|
|
267
|
+
app.use(express.json());
|
|
268
|
+
app.use(express.urlencoded({ extended: true }));
|
|
269
|
+
}
|
|
266
270
|
|
|
267
271
|
/**
|
|
268
272
|
* Allow serving chrome assets
|