Skip to content

[AutoProxy] WSL exports Windows IP wildcards unchanged to NO_PROXY, breaking proxy bypass #41940

Open

Description

@Camsyn

Windows Version

Microsoft Windows [Version 10.0.26200.9711]

WSL Version

2.7.3.0

Are you using WSL 1, WSL 2, or WSLC?

  • WSL 2
  • WSL 1
  • WSLC

Kernel Version

No response

Distro Version

No response

Other Software

No response

Repro Steps

  1. Enable a Windows HTTP proxy with bypass entries such as localhost;127.*;10.*;192.168.* (included in Clash Verge Rev's Windows defaults).

  2. Enable these settings in .wslconfig:

    [wsl2]
    networkingMode=mirrored
    autoProxy=true
  3. Once those settings are active, open a fresh WSL session and inspect no_proxy / NO_PROXY. The imported list contains 127.*.

  4. Start a local server in WSL:

    python3 -m http.server 18080 --bind 127.0.0.1
  5. In a second fresh WSL session, compare the imported bypass list with a CIDR override, keeping the proxy enabled:

    printf 'no_proxy=%s\nNO_PROXY=%s\n' "$no_proxy" "$NO_PROXY"
    
    # loopback get proxied unexpectedly
    curl -q -v --max-time 5 http://127.0.0.1:18080/ -o /dev/null
    # We need to set no_proxy manually to make loopback not being proxied 
    no_proxy=127.0.0.0/8 NO_PROXY=127.0.0.0/8 \
    curl -q -v --max-time 5 http://127.0.0.1:18080/ -o /dev/null

Expected Behavior

Windows IP-range bypass rules should retain their meaning for Linux clients such as curl after import.

Suggested minimal fix: normalize unambiguous numeric IPv4 prefix wildcards when building ProxyBypassesComma, preserving the original ProxyBypasses entries:

127.*       -> 127.0.0.0/8
10.*        -> 10.0.0.0/8
192.168.*   -> 192.168.0.0/16
172.16.*    -> 172.16.0.0/16

Leave other patterns unchanged. This improves compatibility for CIDR-capable clients such as curl.

Precedent: hyper-util PR #309 implements the same normalization when importing WinINET proxy exclusions, fixing hyper #4128.

Actual Behavior

WSL changes the separators but exports the wildcard entries unchanged:

Windows ProxyOverride: localhost;127.*;10.*;192.168.*
WSL NO_PROXY/no_proxy: localhost,127.*,10.*,192.168.*

IP wildcards are valid Windows native proxy bypass notation, but not well-supported in Linux (e.g., curl's NO_PROXY parser does not interpret 127.* as an IP range).

The first request connects through the proxy; the second request (i.e., CIDR override) connects directly.
Without CIDR override, local or private API requests can consequently fail with 502 or connection errors, depending on the proxy.

Relevant source (WSL 2.7.3):

Diagnostic Logs

No response

Activity

  1. github-actions commented on Oct 15, 2026

    @github-actions
    Contributor

    Logs are required for review from WSL team

    If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
    Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

    How to collect WSL logs

    Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

    Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\collect-wsl-logs.ps1
    

    The script will output the path of the log file once done.

    If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

    Once completed please upload the output files to this GitHub issue.

    See Collect WSL logs (recommended method).

    If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

  2. Camsyn commented on Oct 16, 2026

    @Camsyn
    Author

    I think this issue is somewhat of a feature request, aiming to have WSL follow the IP-range bypass rules in Windows when autoproxy is enabled.
    If the reviewers also consider this a problem and agree with my suggested fix, I would be happy to submit a PR (#41941) to address it.

  3. Camsyn commented on Oct 17, 2026

    @Camsyn
    Author

    /feature

  4. github-actions commented on Oct 17, 2026

    @github-actions
    Contributor
    Diagnostic information
    Found '/feature', adding tag 'feature'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions