Ensure proxy url starts with http:// or https:// (#1890)

This commit is contained in:
Buns Shar
2017-04-15 08:21:29 +05:30
committed by Joe Haddad
parent 3d8c8204f8
commit 10dfd892b4

View File

@@ -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.