wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理

启动WSL的时候出现了一个提示

wsl: 检测到 localhost 代理配置,但未镜像到 WSL。
NAT 模式下的 WSL 不支持 localhost 代理。

解决方案 在Windows中的C:\Users<用户>目录下创建一个.wslconfig文件,然后在文件中写入如下内容

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

重启wsl即可