gulp-webserver icon indicating copy to clipboard operation
gulp-webserver copied to clipboard

Supports Websockets

Open jlandure opened this issue 9 years ago • 4 comments

Will it possible to support WS with "proxies section" ? Example on localhost:8080 : {source: '/sock', target: 'localhost:8000', options: {headers: {'ABC_HEADER': 'abc'}, ws: true}}

Behavior:

  • a first call to http://localhost:8080/sock will redirect to http://localhost:8000/sock - and the server returns a redirect for WS (Upgrade:websocket).
  • a redirection to ws://localhost:8000/sock

jlandure avatar Oct 30 '14 16:10 jlandure

would be nice, indeed.

crmn111 avatar Feb 24 '15 14:02 crmn111

LGFM

anarcher avatar Feb 24 '15 15:02 anarcher

You might want try out http-proxy-middleware.

The following code should do the trick; when proxy is used as middleware.

var proxy = require('http-proxy-middleware')('/sock', {target: 'http://localhost:8000', headers: {'ABC_HEADER': 'abc'}, ws: true});

Let me know if it works.

chimurai avatar Jul 28 '15 22:07 chimurai

Is there any news on that? I tried the @chimurai solution, but didn't worked for me.

ghost avatar Nov 18 '16 21:11 ghost