question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

devServer websocket proxy cannot upgrade websocket connection

See original GitHub issue

I’m submitting a bug report

webpack and webpack-dev-server version: webpack: 1.13.2 webpack-dev-server: 1.16.1

Please tell us about your environment: Linux Fedora 22

Current behavior: devServer websocket proxy cannot upgrade websocket connection sporadically

Expected/desired behavior: http-proxy-middleware should upgrade websocket requests always

Howto Reproduce / Setup

setup

 devServer: {
      proxy: {
        '/hyperguard/websocket/*': {
          target: 'ws://localhost:8082',
        ws: true
        }
      }
    }

http stream request

GET /hyperguard/websocket HTTP/1.1
Host: localhost:8079
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Sec-WebSocket-Version: 13
origin: http://localhost:8079
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: yrOcNHCvvVuGgttYgv9nzA==
Connection: keep-alive, Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket

http stream response getting this response only sometimes, if not the websocket connection never be established

HTTP/1.1 101 Switching Protocols
upgrade: websocket
connection: Upgrade
sec-websocket-accept: I3u4B7iakSJWk4yLd02hfn+enus=
  • that issue also occurs on different platforms (ubuntu 14.04, centos7)
  • restarting webpack-dev-server doesnt change anything

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SpaceK33zcommented, Jan 6, 2017

See the comment above me.

1reaction
desytechcommented, Sep 22, 2016

filed this bug on http-proxy-middleware chimurai/http-proxy-middleware#112

Read more comments on GitHub >

github_iconTop Results From Across the Web

websocket proxy cannot upgrade websocket connection #112
I figured out a way to reproduce a workaround with tornado + HPM + webpack-dev-server. If the problem occurs i just have to...
Read more >
Proxy websockets connection within webpack-dev-server
I know how to proxy regular HTTP requests to another backend but it's not working for websockets, presumably because the target in the...
Read more >
DevServer - webpack
This option allows specifying URL to web socket server (useful when you're proxying dev server and client script does not always know where...
Read more >
webpack-dev-server - npm
Start using webpack-dev-server in your project by running `npm i ... --client-web-socket-url <value> Allows to specify URL to web socket ...
Read more >
Server Options - Vite
Configure custom proxy rules for the dev server. ... If the Vite HMR client fails to connect WebSocket, the client will fall back...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found