Skip to content

Server running within WSL2 is inaccessible from a Windows browser #347

Open
@KrisDavie

Description

@KrisDavie

This is a real edge case, so I don't know how we want to to approach it, especially given it is down to the GRPC side of things, which will be changing in the future anyway.

By default both the GServer and the bindserver listen to ::, the IPv6 equivalent of 0.0.0.0.
image

On a linux machine it automatically handles the conversion of 127.0.0.1 -> the local IPv6 address if something is listening, however WSL2's network binding doesn't do this. A couple of small changes can fix this quickly (although not optimally):

var wss = new WebSocketServer({ port: process.argv[2] });
-> var wss = new WebSocketServer({ host: "127.0.0.1", port: process.argv[2] });

and

server.add_insecure_port("[::]:{0}".format(config["gPort"]))
->
server.add_insecure_port(f"{config['localHostAddress']}:{config['gPort']}")

Currently I'm just applying these changes locally in a patch to get my WSL2 dev environment working, but posting as an issue on the extremely low chance someone comes across the same issue.

See: microsoft/WSL#4851 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions