1

I'm running a ubuntu 10.04 i386 desktop edition. I have configured the http proxy via the http_proxy variable. When I use wget I get a connection refused but, curl, apt-get etc. work just fine. Any idea what I'm missing here?

$ echo $http_proxy
http://10.0.0.42:8080/
$ export HTTP_PROXY=$http_proxy
$ wget --proxy=on http://www.google.com
--2010-06-24 18:56:53--  http://www.google.com/
Resolving www.google.com... 74.125.95.106, 74.125.95.147, 74.125.95.99, ...
Connecting to www.google.com|74.125.95.106|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.147|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.99|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.103|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.104|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.105|:80... failed: Connection refused.
$ curl http://www.google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.co.in/">here</A>.
</BODY></HTML>
$ 

6 Answers 6

1

I've found that some programs use the environment variable http_proxy (lower case), while others use HTTP_PROXY (upper case). Because it's quicker than looking up which program uses which variable, I tend to set 'em both.

1

After setting http_proxy like so:

export http_proxy="http://proxy.example.com:8080"

Use wget with this flag:

--proxy=on

You can use

--proxy-username="username" --proxy-passwd="password"

to set proxy username and password where required.

1
  • It is worth to mention that there is something like https_proxy which also should be set if we want to have possibility to use https over the proxy. Otherwise wget/crul will not use proxy for https requests.
    – mtfk
    Commented Apr 17, 2015 at 8:07
1

Thanks for your help guys. I found the solution with some help from the ever helpful folks at #ubuntu. The problem turned out to be the no_proxy that was set to localhost once I unset it wget worked fine

1

In my case I had problems with the proxy blocking the user agent set by wget. So to solve it, I had to set manually the user-agent option with the one used by curl:

 wget --user-agent="curl/7.47.0" http://host.com
0

I had proxy set up with proper config, but that was preventing me download anything using command line.

So had to off the proxy as below,

wget --proxy=off http://apache.claz.org/flume/1.6.0/apache-flume-1.6.0-bin.tar.gz
0

This happened to me when the wgetrc was configured to use port 443 with https_proxy. Once I used port 80 for http_proxy and https_proxy it worked fine.

You must log in to answer this question.

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