As in title, I want to make Ubuntu 20.04 LTS WSL use proxied connections; I am in China, behind the infamous Great Firewall of China, if that doesn't ring any bells, just Google it.

Fortunately I know how to bypass it freely(as in "free of charge"), currently I use Lantern, its http proxy port is 1053, I had set it to "manage system proxy" and "proxy all traffic", I had run these commands:

netsh winhttp set proxy
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d "" /f

And made Lantern proxy PowerShell traffic in addition to browsers and downloaders.

Now, I enabled Windows Subsystem for Linux, installed wsl_update_x64.msi, installed Ubuntu 20.04, and ran this:

sudo apt update

And it downloads files from archive.ubuntu.com and security.ubuntu.com with astonishingly slow speed: several (below 10)KB/s, my connection is 100mbps PPPoE(translates to 11.920928955078125MiB/s download speed), undoubtly it isn't being proxied, so how can I proxy its traffic?


3 Answers 3


Never mind, I had just solved it, again, and found sometimes Google really can be useful, well, I said SOMETIMES.

I just found this: https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-the-proxy-for-apt-for-ubuntu-18-04/

I used these:

sudo touch /etc/apt/apt.conf.d/proxy.conf
sudo vi /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "";

(AND I closed Ubuntu)

Now its speed is much more resonable.

  • 4
    What about git clone, wget, curl, etc... I don't think they are proxied if you do this. Are they?
    – VidathD
    Jul 5, 2021 at 6:58

This worked for me too..

For other general HTTP access you can set proxy as follow

export http_proxy=<proxyUrl>:<proxyPort>

You can also have this in bash profile so that you do not have to set it each time.

  • 1
    This answer is the general solution for http/https connetion. (even working for "$ kubectl krew update" )
    – agfe2
    Dec 13, 2021 at 2:50

I am able to resolve this issue of my Python code by following code

export https_proxy=<proxyUrl>:<proxyPort> && export http_proxy=$https_proxy && no_proxy=.<domainUrl>,,localhost

You can set this to your bash profile for future usage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .