Skip to main content
Localhost loopback allows Android apps running in WSA to connect to services running on your Windows host machine, such as development servers, databases, or local APIs.
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:
  1. Start your development server on Windows (e.g., localhost:3000)
  2. In your Android app, connect to the same address: http://localhost:3000
  3. The connection should work without additional configuration
If automatic loopback doesn’t work, proceed with the manual configuration below.

Manual Configuration

For older WSA versions or when automatic configuration doesn’t work, you can manually enable localhost loopback using PowerShell.
These commands require Administrator privileges and modify Windows Firewall rules for Hyper-V.
1

Open PowerShell as Administrator

  1. Press Win + X
  2. Select Windows Terminal (Admin) or PowerShell (Admin)
  3. Click Yes on the UAC prompt
2

Enable Loopback for WSA

Run the following command to enable loopback:
Set-NetFirewallHyperVVMSetting -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -LoopbackEnabled True
This enables loopback for the WSA virtual machine.
The GUID {9E288F02-CE00-4D9E-BE2B-14CE463B0298} is the official VM Creator ID for Windows Subsystem for Android.
3

Configure Firewall Rule for Specific Port

Create a firewall rule to allow inbound connections on your desired port:
New-NetFirewallHyperVRule -DisplayName LoopbackAllow -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -Direction Inbound -Action Allow -LocalPorts [PORT]
Replace [PORT] with your actual port number.Example for port 3000:
New-NetFirewallHyperVRule -DisplayName LoopbackAllow -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -Direction Inbound -Action Allow -LocalPorts 3000
4

Restart WSA

  1. Open WSA Settings
  2. Click Turn off to shut down WSA
  3. Wait a few seconds
  4. Open any Android app or WSA Settings to restart WSA

Testing the Connection

Verify that localhost loopback is working:
1

Start a Test Server on Windows

Create a simple test server. For example, using Python:
python -m http.server 8000
Or using Node.js:
npx http-server -p 8000
2

Test from Windows

Open a browser on Windows and navigate to:
http://localhost:8000
Confirm the server is accessible.
3

Test from WSA

Install a web browser in WSA (via sideloading) and navigate to:
http://localhost:8000
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:
# Allow port 3000
New-NetFirewallHyperVRule -DisplayName "WSA-Loopback-3000" -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -Direction Inbound -Action Allow -LocalPorts 3000

# Allow port 5000
New-NetFirewallHyperVRule -DisplayName "WSA-Loopback-5000" -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -Direction Inbound -Action Allow -LocalPorts 5000

# Allow port 8080
New-NetFirewallHyperVRule -DisplayName "WSA-Loopback-8080" -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -Direction Inbound -Action Allow -LocalPorts 8080
Or allow a range of ports:
New-NetFirewallHyperVRule -DisplayName "WSA-Loopback-Range" -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -Direction Inbound -Action Allow -LocalPorts 3000-9000

Viewing and Managing Firewall Rules

List WSA Firewall Rules

Get-NetFirewallHyperVRule | Where-Object {$_.VMCreatorId -eq '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}'}

Remove a Specific Rule

Remove-NetFirewallHyperVRule -DisplayName "LoopbackAllow"

Disable Loopback

To disable loopback entirely:
Set-NetFirewallHyperVVMSetting -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -LoopbackEnabled False

Common Development Scenarios

React development servers typically run on port 3000:
New-NetFirewallHyperVRule -DisplayName "WSA-React-Dev" -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -Direction Inbound -Action Allow -LocalPorts 3000
In your React app’s Android client, connect to:
const API_URL = 'http://localhost:3000';

Troubleshooting

  • Verify the Windows server is bound to 0.0.0.0 or localhost, not just 127.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.1 instead of localhost in your Android app
  • 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
  • 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
This guide covers Windows → WSA connections. For WSA → Windows:
  1. Find WSA’s IP in Developer settings
  2. Configure your Windows server to listen on all interfaces (0.0.0.0)
  3. Access the server from Windows using WSA’s IP address
  4. Add Windows Firewall rules if needed

Security Considerations

Important Security Notes:
  • Only expose ports you actively need
  • Don’t expose production databases or sensitive services
  • Remove firewall rules when development is complete
  • Be cautious with 0.0.0.0 bindings on public networks
  • Use authentication even for local development servers
To remove all WSA loopback rules when done:
Get-NetFirewallHyperVRule | Where-Object {$_.VMCreatorId -eq '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}'} | Remove-NetFirewallHyperVRule
Set-NetFirewallHyperVVMSetting -VMCreatorId '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}' -LoopbackEnabled False

Need Help?

Join the WSA Community Discord for development and networking support

Build docs developers (and LLMs) love