I've got Ubuntu in WSL 2 running on Windows 10 (Version 10.0.19044 Build 19044) host OS.
Windows Defender Firewall is fully disabled.
What does work
A very basic Express app
index.js:const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) })Inside WSL, I run
npm init,npm i expressand finallynode index.js.Then in a browser on the host OS I visit http://localhost:3000 and I see "Hello World!".
Other Node apps such as EmberJS:
npx ember-cli -- new foo cd foo/ npm startThis starts a dev server on port 4200 inside WSL.
Then in a browser on the host OS I visit http://localhost:4200 and I see a boilerplate app.
What does not work
(of course, I make sure first that ports are available)
Running a Node
http-server:I start
npx http-server -p 3000inside WSL.I access http://localhost:3000 in the host OS. Despite using the same port and host as before, I see "Connection refused".
From inside WSL, the page does open (e. g. with
links http://localhost:3000).Running a Python HTTP server:
I start
python3 -m http.server 4200inside WSL.I access http://localhost:4200 in the host OS. Despite using the same port and host as before, I see "Connection refused".
From inside WSL, the page does open (e. g. with
links http://localhost:4200).Running headless Chrome with
--remote-debugging-port.Chrome on the host OS is unable to connect to the headless Chrome in WSL.
What I tried
Neither of these helps:
- Rebooting.
wsl --shutdown.- Googling. A lot.
Notes
When I start e. g. npx http-server -p 4200, an entry appears in the Network tab of the Resource Moninor in the host OS. It says port 4200, process wslhost.exe, firewall status "Allowed, not restricted".
Yet, I see this:
Please help.



