How to Configure WGet to Work with Proxy Server

The Problem

I want to configure WGet to go through a proxy server without having to specify that on the command line

The Solutions

The first solution is easy: I can set a shell variable called http_proxy. Here is an example in bash:

$ http_proxy=http://proxy-server:8080
$ export http_proxy

Another solution is to place this information in a configuration file called ~/.wgetrc. Here is a sample:

http_proxy=http://proxy-server:8080

If you have administrative rights and want to configure the system-wide behavior, then place the above line into the file /etc/wgetrc.

Conclusion

This is a very simple configuration problem, but it took me a while to figure out because I assumed that my system came with proxy pre-configured, but it was not. If you use wget on your system and it took a long time to get some trivia file (for example http://google.com) and you are sure that your internet connection is working fine, then you might have a proxy problem. Normally, you only encounter proxy servers at work, school, or other organization, but not at home.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s