Search code examples
proxywget

Why does wget (windows) behind a proxy needs the PROXY_HTTP/HTTPS environment variables, and Chrome doesn't


I tried to download files from google drive using wget (on windows) using the script shown here: [JULY 2020 - Windows users batch file solution]wget/curl large file from google drive.

It works well, but when computer is behind proxy, it will work ONLY if I will set environment variables PROXY_HTTP and PROXY_HTTP (It may be that it can also set by flag in the command, but I didn't try it)

The fact that I can download files from google drive using Chrome without these environment variables and without setting chrome for the proxy gives me the understanding that there is a way to download behind proxy without setting an application for the proxy.

How can I make wget works without need to set it manually (by flag or by environment variables) for the proxy?


Solution

  • In all likelyhood your Chrome also has a proxy set up in some way. In any case, the simplest way to define the proxy for wget is to create a .wgetrc file in your local home folder and set the following:

    > vi ~/.wgetrc
    
    use_proxy=on
    http_proxy=http://[proxy_ip]:[proxy_port]
    https_proxy=https://[proxy_ip]:[proxy_port]
    ftp_proxy=http://[proxy_ip]:[proxy_port]
    

    That should be all you need to do.