Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoProxy=true doesn't works well on WSL2 preview 2.0.3.0 #10583

Closed
1 task done
stevejohnson7 opened this issue Oct 3, 2023 · 9 comments
Closed
1 task done

autoProxy=true doesn't works well on WSL2 preview 2.0.3.0 #10583

stevejohnson7 opened this issue Oct 3, 2023 · 9 comments
Labels

Comments

@stevejohnson7
Copy link

stevejohnson7 commented Oct 3, 2023

Windows Version

Microsoft Windows [Version 10.0.22621.2361]

WSL Version

2.0.3.0

Are you using WSL 1 or WSL 2?

  • WSL 2

Kernel Version

5.15.123.1-1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

  1. Upgrade WSL to 2.0 by wsl --update --pre-release
  2. Write content below into %userprofile%\.wslconfig:
[experimental]
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true
  1. wsl --shutdown to shutdown WSL Ubuntu
  2. Wait for some time, restart Ubuntu.

Expected Behavior

Since autoProxy=true, Ubuntu in WSL2 should read Windows's proxy settings and adapt to itself.
Commands like curl or git should use proxy to access websites.

Actual Behavior

It is known to all that www.google.com is banned in China mainland.
Proxies are needed to overcome the limitations.
Here we use Clash to proxy requests. It works at local 7890 port as a http proxy.

Windows Settings:
Proxy to 127.0.0.1:7890 enabled
image
And it works well
image

Ubuntu:
None of $http_proxy and $https_proxy is set

$ echo $https_proxy

(nothing output)
$ echo $http_proxy

(nothing output)

And curl will finally timeout

$ curl www.google.com
curl: (7) Failed to connect to www.google.com port 80: Connection timed out

It means the "autoProxy" doesn't actually work

Diagnostic Logs

No response

@stevejohnson7 stevejohnson7 changed the title "autoProxy=true" doesn't works well on WSL2 "autoProxy=true" doesn't works well on WSL2 preview 2.0.3.0 Oct 3, 2023
@OneBlue OneBlue added the network label Oct 3, 2023
@craigloewen-msft craigloewen-msft changed the title "autoProxy=true" doesn't works well on WSL2 preview 2.0.3.0 autoProxy=true doesn't works well on WSL2 preview 2.0.3.0 Oct 4, 2023
@keith-horton
Copy link
Member

Sorry this didn't work for you. I tested your exact proxy settings from the screenshot and we see the proxy mirroring correctly.

Can you please take a trace with this file: https://github.com/microsoft/WSL/blob/master/diagnostics/wsl_networking.wprp

Please wsl --shutdown, then start the script and repro.
Thanks!

@stevejohnson7
Copy link
Author

Sorry this didn't work for you. I tested your exact proxy settings from the screenshot and we see the proxy mirroring correctly.

Can you please take a trace with this file: https://github.com/microsoft/WSL/blob/master/diagnostics/wsl_networking.wprp

Please wsl --shutdown, then start the script and repro. Thanks!

Of course. I have sent the trace report to your email [email protected] with the title of WSL trace report needed in WSL issue #10583.

@damienalexandre
Copy link

I have kind of the same issue but isn't this experimental option only available on Windows 11? (From the report I see you have Windows 10 like me).

Will it be made available on Windows 10?

@keith-horton
Copy link
Member

Sorry, the auto-proxy feature isn't currently set to be backported.
When we looked at Steve's traces, we see WSL setting the environment variable before we startup the distro. It's unknown why those variables are not visible once the distro starts. This isn't anything we have seen before - and we cannot repro it :(

@stevejohnson7
Copy link
Author

Sorry, the auto-proxy feature isn't currently set to be backported. When we looked at Steve's traces, we see WSL setting the environment variable before we startup the distro. It's unknown why those variables are not visible once the distro starts. This isn't anything we have seen before - and we cannot repro it :(

Sad to hearing this.
But no matter. As an alternative, I added some shell commands in .zshrc to automatically set the value of $http_proxy and $https_proxy.
As it cannot be reproducted, I think it maybe the fault of my distro and I will close this issue. if any other similar report has emerged, please let me know, thanks a lot.

@hotuns
Copy link

hotuns commented Dec 7, 2023

I am using the clash tun mode and have disabled autoProxy. Now I can use the proxy normally in WSL2

@trallnag
Copy link

trallnag commented Apr 3, 2024

@hotuns, what is "clash tun mode"?

@black-pwq
Copy link

@trallnag Basically, it is a switch in the famous proxy application, clash, which you can turn on to make proxy work on network layer.

@xyy94813
Copy link

@stevejohnson7
Hi, can you share your shell command for resolve this issue??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants