Assume you have a process which listens on TCP 3000 in WSL2

The process should bind for the host 0.0.0.0, not 127.0.0.1 and not localhost. Most times software has a host configuration like --host 0.0.0.0 or similar. You can Google "How to set host 0.0.0.0 in Svelte/Vue/React etc".

Run PowerShell From Administrator and type there:

New-NetFirewallRule -DisplayName "Allow WSL2 HTTP Server" -Direction Inbound -Protocol TCP -LocalPort 3000 -Action Allow

In WSL 2 terminal

ip a

Search for inet near eth0 to find your WSL2 IP:

Image

Return to Power Shell and type

netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=192.168.217.58

Replace connectaddress with your WSL 2 IP.

To find out address of your PC, write in Power Shell:

ipconfig

Search for Wi-FI adapter and IPv4 address:

Image

On your phone connected to same Wi-FI got to https://192.168.28.246:3000  (change it with your IP)