mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-06-19 06:36:38 +08:00
Ensure proxy url starts with http:// or https:// (#1890)
This commit is contained in:
8
packages/react-scripts/scripts/start.js
vendored
8
packages/react-scripts/scripts/start.js
vendored
@@ -188,6 +188,14 @@ function addMiddleware(devServer) {
|
||||
console.log(chalk.red('Instead, the type of "proxy" was "' + typeof proxy + '".'));
|
||||
console.log(chalk.red('Either remove "proxy" from package.json, or make it a string.'));
|
||||
process.exit(1);
|
||||
// Test that proxy url specified starts with http:// or https://
|
||||
} else if (!/^http(s)?:\/\//.test(proxy)) {
|
||||
console.log(
|
||||
chalk.red(
|
||||
'When "proxy" is specified in package.json it must start with either http:// or https://'
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Otherwise, if proxy is specified, we will let it handle any request.
|
||||
|
||||
Reference in New Issue
Block a user