From 251a52fef6f3e62c0c10e350f54a87eddaf073d2 Mon Sep 17 00:00:00 2001 From: Andrew Hyndman Date: Sun, 27 Feb 2022 01:28:14 -0800 Subject: [PATCH] fix: never proxy hot-reload websocket requests Both create-react-app and vue-cli-service have introduced workarounds for this, but it seems to me that this is always desirable behaviour for webpack-dev-server. https://github.com/vuejs/vue-cli/commit/72ba7505aff2a8314e82aa5082379a77504a1fcb https://github.com/facebook/create-react-app/pull/7444 --- lib/Server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Server.js b/lib/Server.js index 4b8befb376..505898f7f6 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -1841,7 +1841,10 @@ class Server { (this.server).on( "upgrade", /** @type {RequestHandler & { upgrade: NonNullable }} */ - (webSocketProxy).upgrade + (req, ...rest) => + req.url !== this.options.webSocketServer.options.path + ? webSocketProxy.upgrade(req, ...rest) + : null, ); }, this); }