How to connect wsl to a windows localhost?

I'm trying to let WSL use a localhost proxy(actually its Fiddler) on my windows, but I can't see any connection like that, and downloads usually fail, how do I fix that?

I know that I can connect to Linux localhost from the windows one, but how can I reverse this?

WSL is Ubuntu 18.04


I am not sure if the following will work with applications that are bound to just localhost, but this worked for Fiddler and WSL2:

  1. Set the Fiddler option "Allow remote computers to connect" and restart Fiddler Fiddler options: allow remote computers to connect

  2. Grab your WSL network connection info (on my machine, the adapter is called vEthernet (WSL)) WSL network connection details

  3. Use that address, e.g. 172.26.224.1 where you would normally use localhost curl -I 172.26.224.1 output in WSL2


You should run the following command in a powershell run as administrator:

New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL)"  -Action Allow

This command comes from this WSL2 ticket. Any firewall rule related to WSL IP address won't be effective because with WSL2 IP changes every time.