Previously, we published a blog post about fixing the 0x80071772 error when installing WSL applications. Today, we’re tackling another common WSL error - “wsl: localhost proxy configuration detected but not mirrored to WSL. WSL in NAT mode does not support localhost proxy.”

Cause Analysis

Many users run certain software on Windows that requires modifying the system proxy settings, which can trigger this error in WSL. Here’s the specific reason:

Your Windows host has a local proxy set up, such as 127.0.0.1:1080, but this proxy configuration is not properly mirrored into the Linux subsystem inside WSL. Under WSL’s NAT network mode, localhost (127.0.0.1) is isolated between WSL and the Windows host.

In simpler terms:

  • The 127.0.0.1 on the Windows host is the Windows loopback address.
  • The 127.0.0.1 inside WSL2 is the internal loopback address of the WSL virtual machine — it’s not the Windows host address!
  • In NAT mode, WSL and Windows communicate through a virtual network interface, and their localhost addresses are not the same.
  • If you try to connect to 127.0.0.1:1080 from inside WSL, you’re actually connecting to WSL itself, not to the proxy service running on Windows.

That’s why the system warns you: in NAT mode (which is the default for WSL2), this configuration won’t work directly and needs additional handling.

Solution

Most users today are running WSL2, so we can leverage the experimental feature of the WSL global configuration file to fix this issue.

Here’s how to do it:

In your user directory (C:\Users\YourUsername), create a .wslconfig file with the following content:

[experimental]
autoMemoryReclaim=gradual
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

After saving the file, run the following command in the terminal to shut down WSL:

wsl --shutdown

Then reopen your installed WSL distribution (e.g., Ubuntu 22.04) to restart WSL, and the warning should disappear.

If you’re curious about what each configuration item does, here’s a detailed explanation —

ConfigurationMeaningRelevance to the Issue
autoMemoryReclaim=gradualAutomatically reclaims WSL memory gradually, so WSL no longer permanently occupies a large amount of RAM.Unrelated to proxy settings, used for memory optimization.
networkingMode=mirroredNetworking mirror mode: makes WSL2 network directly “mirror” the Windows network environment, including localhost.Key point! Ensures WSL’s localhost and Windows host’s localhost point to the same network, removing isolation.
dnsTunneling=trueRoutes DNS requests through the Windows host to avoid DNS pollution and resolution errors.Auxiliary support, related to proxy behavior.
firewall=trueRoutes WSL network traffic through the Windows firewall for unified control.Security enhancement, not directly related to the warning.
autoProxy=trueAutomatically syncs Windows system proxy settings into the WSL environment.Key point! Automatically configures Windows proxy (e.g., 127.0.0.1:1080) inside WSL without manual http_proxy setup.