Skip to content

Commit

Permalink
Ensure proxy url starts with http:// or https:// (#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
bunshar authored and Timer committed Apr 15, 2017
1 parent 3d8c820 commit 10dfd89
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/react-scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 10dfd89

Please sign in to comment.