Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/react-dev-utils/WebpackDevServerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,14 @@ function prepareProxy(proxy, appPublicFolder) {
process.exit(1);
}

// If proxy is specified, let it handle any request except for files in the public folder.
// If proxy is specified, let it handle any request except for
// files in the public folder and requests to the WebpackDevServer socket endpoint.
// https://github.com/facebook/create-react-app/issues/6720
function mayProxy(pathname) {
const maybePublicPath = path.resolve(appPublicFolder, pathname.slice(1));
return !fs.existsSync(maybePublicPath);
const isPublicFileRequest = fs.existsSync(maybePublicPath);
const isWdsEndpointRequest = pathname.startsWith('/sockjs-node'); // used by webpackHotDevClient
return !(isPublicFileRequest || isWdsEndpointRequest);
}

if (!/^http(s)?:\/\//.test(proxy)) {
Expand Down