Official Support in WSA 2308+Localhost loopback has been officially added in WSA update 2308 and later versions. If you’re running a recent version of WSA, this functionality should work out of the box without manual configuration.This guide is provided for reference and troubleshooting purposes, or if you need to configure specific ports.
Use Cases
You might need localhost loopback when:- Testing Android apps that connect to a development server running on Windows
- Accessing a local database (MySQL, PostgreSQL, etc.) from WSA
- Connecting to local APIs during development
- Using local web services from Android apps
- Debugging client-server applications
Automatic Configuration (WSA 2308+)
For WSA version 2308 and newer, localhost loopback should work automatically:- Start your development server on Windows (e.g.,
localhost:3000) - In your Android app, connect to the same address:
http://localhost:3000 - The connection should work without additional configuration
Manual Configuration
For older WSA versions or when automatic configuration doesn’t work, you can manually enable localhost loopback using PowerShell.Open PowerShell as Administrator
- Press Win + X
- Select Windows Terminal (Admin) or PowerShell (Admin)
- Click Yes on the UAC prompt
Enable Loopback for WSA
Run the following command to enable loopback:This enables loopback for the WSA virtual machine.
Configure Firewall Rule for Specific Port
Create a firewall rule to allow inbound connections on your desired port:Replace
[PORT] with your actual port number.Example for port 3000:Testing the Connection
Verify that localhost loopback is working:Start a Test Server on Windows
Create a simple test server. For example, using Python:Or using Node.js:
Test from WSA
Install a web browser in WSA (via sideloading) and navigate to:Or use an app that makes HTTP requests to
localhost:8000.If you can access the content, loopback is working correctly.Multiple Ports
If you need to expose multiple ports, create a firewall rule for each:Viewing and Managing Firewall Rules
List WSA Firewall Rules
Remove a Specific Rule
Disable Loopback
To disable loopback entirely:Common Development Scenarios
- React Development Server
- Node.js/Express API
- Database Connection
- Django Development Server
React development servers typically run on port 3000:In your React app’s Android client, connect to:
Troubleshooting
Connection refused from WSA
Connection refused from WSA
- Verify the Windows server is bound to
0.0.0.0orlocalhost, not just127.0.0.1 - Check Windows Firewall rules are applied correctly
- Ensure the server is running on Windows before connecting from WSA
- Restart WSA after applying firewall rules
- Try using
127.0.0.1instead oflocalhostin your Android app
Firewall command fails
Firewall command fails
- Ensure PowerShell is running as Administrator
- Verify you’re running Windows 11 (Hyper-V firewall rules require Windows 11)
- Check for typos in the VM Creator ID
- Try running Windows Update to ensure latest WSA version
Works on Windows but not WSA
Works on Windows but not WSA
- Confirm loopback is enabled:
Get-NetFirewallHyperVVMSetting - Verify firewall rules exist:
Get-NetFirewallHyperVRule - Check that the port matches between server and firewall rule
- Some apps might cache network settings - try reinstalling the Android app
- Test with a simple HTTP server first to rule out app-specific issues
Need to access WSA from Windows
Need to access WSA from Windows
This guide covers Windows → WSA connections. For WSA → Windows:
- Find WSA’s IP in Developer settings
- Configure your Windows server to listen on all interfaces (
0.0.0.0) - Access the server from Windows using WSA’s IP address
- Add Windows Firewall rules if needed
Security Considerations
To remove all WSA loopback rules when done:Need Help?
Join the WSA Community Discord for development and networking support
