Search code examples
fastapiwindows-subsystem-for-linux

How do I access WSL localhost


I'm running a simple FastAPI application in WSL2 in a anaconda env, the code is very simple, as in the image

1

The app is running in localhost:127.0.0.1:8000 but I can't access it from Windows browser.

How do I do it, because later I want to test the API using swagger ui?

I used ip route or wsl hostname -i command to see the ip of WSL machine but none of them worked


Solution

  • Found the answer, turned out I still have a VPN running and it seems that it prevented me from accessing