Skip to content

Commit f61cba1

Browse files
bunsharTimer
authored andcommitted
Ensure proxy url starts with http:// or https:// (#1890)
1 parent cb41a76 commit f61cba1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/react-scripts/scripts/utils/addWebpackMiddleware.js

+8
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ module.exports = function addWebpackMiddleware(devServer) {
8989
)
9090
);
9191
process.exit(1);
92+
// Test that proxy url specified starts with http:// or https://
93+
} else if (!/^http(s)?:\/\//.test(proxy)) {
94+
console.log(
95+
chalk.red(
96+
'When "proxy" is specified in package.json it must start with either http:// or https://'
97+
)
98+
);
99+
process.exit(1);
92100
}
93101

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

0 commit comments

Comments
 (0)