Coder Perfect

How do I configure wget to use a proxy?

Problem

I’d like to use wget to download something using a proxy:

HTTP Proxy: 127.0.0.1
Port: 8080

There is no need for a login or password for the proxy.

I’m not sure how I’m going to accomplish it.

Asked by Hakim

Solution #1

For all system users via /etc/wgetrc, or for a single user via the /.wgetrc file:

use_proxy=yes
http_proxy=127.0.0.1:8080
https_proxy=127.0.0.1:8080

Alternatively by using the -e arguments after the URL:

wget ... -e use_proxy=yes -e http_proxy=127.0.0.1:8080 ...

Answered by amaksr

Solution #2

In the command line, type:

$ export http_proxy=http://proxy_host:proxy_port

for authenticated proxy,

$ export http_proxy=http://username:password@proxy_host:proxy_port

and then run

$ wget fileurl

Use https proxy instead of http proxy for https. You may also put these lines in your /.bashrc file to avoid having to run them every time.

Answered by shivshnkr

Solution #3

Uncomment the following possible configs in /etc/wgetrc and use them…

# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/

# If you do not want to use proxy at all, set this to off.
#use_proxy = on

Answered by hovanessyan

Solution #4

wget uses environment variables somthing like this at command line can work:

export http_proxy=http://your_ip_proxy:port/
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export dns_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

Answered by juan_liga

Solution #5

After attempting numerous tutorials to set up my Ubuntu 16.04 LTS behind an authorized proxy, I found success with the following steps:

Edit /etc/wgetrc:

$ sudo nano /etc/wgetrc

Uncomment these lines:

#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/
#use_proxy = on

Replace http://proxy.yoyodyne.com:18023/ with http://proxy.yoyodyne.com:18023/. http://username:password@domain:port/username:password@domain:port/username:password@domain:port/user

Answered by Janderson Silva

Post is based on https://stackoverflow.com/questions/11211705/how-to-set-proxy-for-wget