Skip to content

Commit 10dfd89

Browse files
bunsharTimer
authored andcommitted
Ensure proxy url starts with http:// or https:// (#1890)
1 parent 3d8c820 commit 10dfd89

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/react-scripts/scripts/start.js

+8
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ function addMiddleware(devServer) {
188188
console.log(chalk.red('Instead, the type of "proxy" was "' + typeof proxy + '".'));
189189
console.log(chalk.red('Either remove "proxy" from package.json, or make it a string.'));
190190
process.exit(1);
191+
// Test that proxy url specified starts with http:// or https://
192+
} else if (!/^http(s)?:\/\//.test(proxy)) {
193+
console.log(
194+
chalk.red(
195+
'When "proxy" is specified in package.json it must start with either http:// or https://'
196+
)
197+
);
198+
process.exit(1);
191199
}
192200

193201
// Otherwise, if proxy is specified, we will let it handle any request.

0 commit comments

Comments
 (0)