Skip to content

Proxy websocket with proxy.conf.json #9618

Closed
@jfcere

Description

@jfcere

I am trying to proxy websockets using ng serve --proxy-config proxy.conf.json but could'nt get it to work correctly as I am getting this error:

WebSocket connection to 'ws://stream/connect' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

This closed issue #6081 did not helped neither did this stackoverflow answer.

Am I missing something? Is it doable?

Repro steps

Here is how I instantiated the websocket and my proxy configuration:

websocket instantiation

const ws = new WebSocket('ws://stream/connect');

proxy.conf.json

"stream/**": {
  "target": "wss://localhost:8080",
  "secure": false,
  "ws": true,
  "logLevel": "debug"
}

I also tried the following patterns with the upper configuration but with no avail:

"stream/"
"stream/*"
"stream/**"
"*stream"
"*stream/"
"*stream/*"
"*stream/**"
"**stream"
"**stream/"
"**stream/*"
"**stream/**"
"/stream"
"/stream/"
"/stream/*"
"/stream/**"

Versions

Angular CLI: 1.5.0
Node: 6.11.0
OS: win32 x64
Angular: 4.4.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, tsc-wrapped

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack-bundle-analyzer: 2.9.1
webpack: 3.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions