gulp-webserver
gulp-webserver copied to clipboard
Supports Websockets
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 tohttp://localhost:8000/sock
- and the server returns a redirect for WS (Upgrade:websocket
). - a redirection to
ws://localhost:8000/sock
would be nice, indeed.
LGFM
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.
Is there any news on that? I tried the @chimurai solution, but didn't worked for me.