diff --git a/packages/react-dev-utils/WebpackDevServerUtils.js b/packages/react-dev-utils/WebpackDevServerUtils.js index 0a3e233e641..df428313cca 100644 --- a/packages/react-dev-utils/WebpackDevServerUtils.js +++ b/packages/react-dev-utils/WebpackDevServerUtils.js @@ -324,6 +324,11 @@ function prepareProxy(proxy, appPublicFolder) { // If this heuristic doesn’t work well for you, use a custom `proxy` object. context: function(pathname, req) { return ( + // Resolves an issue with WebSocket (#5280). + (!pathname.startsWith("/sockjs-node/") && + req.upgrade && + req.headers.upgrade && + req.headers.upgrade.toLowerCase() === 'websocket') || req.method !== 'GET' || (mayProxy(pathname) && req.headers.accept &&