Skip to content

Error: Server sent no subprotocol #1862

@VidarHUN

Description

@VidarHUN
  • I've searched for any related issues and avoided creating a duplicate
    issue.

Description

Reproducible in:

  • version: current
  • Node.js version(s): 14
  • OS version(s): alpine
  • Container base image: node:14-alpine

Steps to reproduce:

I have 2 container which are works like a websocket proxy. So each container is a server and a client to and run the same code.
In my case the first one can handle the incoming traffic and create a new connection to the second container and the second container is trying to forward the traffic to the end.

Code looks like this:
var ws = new WebSocket(url, s.metadata.HTTP["headers"]["sec-websocket-protocol"], options);
Where the options contain the headers.

Expected result:

The traffic flow through the two 2 container with the sub protocol.

Actual result:

The second container cannot forward the traffic due Error: Server sent no subprotocol
In the first container I have these options:

{
  headers: {
    upgrade: 'websocket',
    origin: '192.168.99.1',
    'sec-websocket-version': '13',
    connection: 'upgrade'
  }
}

And the second one works with this:

{
  headers: {
    'sec-websocket-version': '13',
    connection: 'upgrade',
    upgrade: 'websocket',
    origin: '192.168.99.1',
    'sec-websocket-extensions': 'permessage-deflate; client_max_window_bits'
  }
}

I don't modify any of these headers.

I saw that the error is generated because the serverProt is undefined. I tried to insert sec-websocket-protocol field by hand, into the second headers, but I got the same result.

Attachments:

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