proxying websockets broken in 2.2.1
See original GitHub issueExpected behavior
Able to proxy websockets with webpack 2.
Actual behavior
Not able to proxy websockets with webpack 2.
Setup
webpack-dev-server v2.2.1 was just pushed to stable.
At the previous stable version, v1.16.2, this webpack config works:
devServer: {
https: true,
proxy: {
'/my-backend': {
changeOrigin: true,
pathRewrite: {'^/my-backend': ''},
target: myBackendUrl,
ws: true,
},
}
At v2.2.1, it does not. Instead I get:
TypeError: Cannot read property 'on' of null
at catchUpgradeRequest (/work/my-project/node_modules/http-proxy-middleware/lib/index.js:56:19)
at middleware (/work/my-project/node_modules/http-proxy-middleware/lib/index.js:48:13)
at /work/my-project/node_modules/webpack-dev-server/lib/Server.js:223:15
at Layer.handle [as handle_request] (/work/my-project/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/work/my-project/node_modules/express/lib/router/index.js:312:13)
at /work/my-project/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/work/my-project/node_modules/express/lib/router/index.js:330:12)
at next (/work/my-project/node_modules/express/lib/router/index.js:271:10)
at middleware (/work/my-project/node_modules/http-proxy-middleware/lib/index.js:43:13)
at /work/my-project/node_modules/webpack-dev-server/lib/Server.js:223:15
at Layer.handle [as handle_request] (/work/my-project/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/work/my-project/node_modules/express/lib/router/index.js:312:13)
at /work/my-project/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/work/my-project/node_modules/express/lib/router/index.js:330:12)
at next (/work/my-project/node_modules/express/lib/router/index.js:271:10)
at goNext (/work/my-project/node_modules/webpack-dev-middleware/middleware.js:28:49)
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Tomcat servlet will not complete websocket connection
The most obvious difference is the 2.2 working server is proxying to a wss: address while the 2.4 broken server is proxying to...
Read more >Apache 2.2.15 with websocket not working...already ... - NodeBB
I figured out exactly what my issue is with websockets. ... followed steps in https://docs.nodebb.org/en/latest/configuring/proxies/apache2.
Read more >Proxy configuration file (PAC) and WebSockets?
I know a websocket connection should start its life as a normal http connection and then upgrade, and this we see in the...
Read more >SignalR fails to connect to server using WebSocket on Chrome
I am using jquery.signalR-2.2.0.js for signalR connection. I have following code var connection = $.hubConnection(); var proxy ...
Read more >python-websockets(1) - Arch manual pages
#!/usr/bin/env python import asyncio import websockets async def hello(): async with websockets.connect("ws://localhost:8765") as websocket: await websocket.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@shellscape Version 4 still uses sockJS.
Closing due to age, inactivity, and that we’re replacing SockJS with a native solution for v3.