9

I am using an HTTP proxy on MacOS 10.7 (which works for Safari.app, when set in the system preferences). I'm now trying to set the proxy for command-line applications using the $http_proxy environment variable. However, I'm seeing the following error (proxy details replaced by uppercase variables

$ export http_proxy=PROXY:PORT
$ wget http://www.google.com
--2012-01-31 17:31:31--  http://www.google.com/
Resolving PROXY (PROXY)... PROXY_IP
Connecting to PROXY (PROXY)|PROXY_IP|:PORT... failed: Connection refused.

Any ideas what I might be doing wrong? Thanks!

2
  • 1
    Do you need a username/password for this proxy?
    – Daniel Beck
    Commented Jan 31, 2012 at 16:45
  • No, I do not need a username/password
    – astrofrog
    Commented Feb 10, 2012 at 11:28

2 Answers 2

6

I hope this is not a dumb answer but do you have real values for PROXY and PORT. It should normally look something like

export http_proxy=http://myproxy.myorg.com:8080/ 

or

export http_proxy=http://10.20.1.1:8080/ 

Also try setting the variable in caps eg.

export HTTP_PROXY=http://myproxy.myorg.com:8080/ 

Finally there is normally some sort of authentication\verification on the proxy for example it might need to be configured to check the source address. Is your address configured on it?

1
  • 1
    I assume he's simply protecting his privacy by replacing actual IP and Ports with PROXY/PORT. Commented Dec 30, 2013 at 2:02
0

Connection refused indicates that that the given ip address and port are atleast in theory valid but the host is blocking the connection because a) firewall doesnt let your connection to the actual proxy server software or b) there is no proxy server running in that particular host in that particular port.

First line of debugging this would be to use telnet in terminal.

  1. telnet PROXY PORT
  2. telnet PROXY_IP PORT

If both cases fail with "connection refused", problem is in the other (proxy) end or you dont have proper name/ip/port for your proxy.

If either one fails and another works, there's definitely some sort of dns error (which again, you might not be able to fix on your own)

PS. Atleast on linux, typically http and https proxy variables are exported with full urls including the protocol: export http_proxy=http://foo.bar.biz:8080/

You must log in to answer this question.

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