I want to set up a public HTTP proxy using Squid. I installed it successfully on Ubuntu 14.04 and just added two lines in /etc/squid3/squid.conf:

http_access allow all
http_port 3120 transparent

However trying to curl MY_SERVER_IP_HERE:3120 ya.ru, I get curl: (52) Empty reply from server. If don't set transparent directive in /etc/squid3/squid.conf, I get The requested URL could not be retrieved error in my browser. What am I doing wrong?


You are hitting your proxy via curl not telling curl to use the proxy.. Try this

http_proxy=http://your.proxy.server:3120/ curl http://ya.ru

You can make it perminate for the session by

export http_proxy=http://your.proxy.server:3120/
| improve this answer | |

Basically, one can run two kinds of (HTTP) proxies:

  • Normal: you need to configure each client (i.e. browsers) for using it.
  • Transparent: Don't demand configuration, the hosts' traffic is sent to the proxy by their default gateway (using firewall rules). AFAIK, it is used on local networks.

As you can't control other people network settings, you should remove the transparent keyword from the http_port line, and tell your programs what proxy they should use. For most Linux command line programs, you'll use three environment vars: http_proxy, https_proxy and ftp_proxy (for HTTP, HTTPS and FTP protocols respectivelly).


export http_proxy="http://MY_SERVER_IP_HERE:3120"
export https_proxy="http://MY_SERVER_IP_HERE:3120"
export ftp_proxy="http://MY_SERVER_IP_HERE:3120"
curl http://ya.ru
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.