Skip to content

Commit 2412114

Browse files
Viacheslav Lotsmanovciis0
Viacheslav Lotsmanov
authored andcommitted
add env var PROXY for overridable "proxy" for react-scripts dev server
facebook#8598
1 parent f04bd63 commit 2412114

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/react-scripts/scripts/start.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
5959
// Tools like Cloud9 rely on this.
6060
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
6161
const HOST = process.env.HOST || '0.0.0.0';
62+
const PROXY = process.env.PROXY || null;
6263

6364
if (process.env.HOST) {
6465
console.log(
@@ -121,7 +122,7 @@ checkBrowsers(paths.appPath, isInteractive)
121122
webpack,
122123
});
123124
// Load proxy config
124-
const proxySetting = require(paths.appPackageJson).proxy;
125+
const proxySetting = PROXY || require(paths.appPackageJson).proxy;
125126
const proxyConfig = prepareProxy(
126127
proxySetting,
127128
paths.appPublic,

0 commit comments

Comments
 (0)