Using Squid as a transparent *outgoing* proxy

Hey guys, I'm fairly new to the world of proxies, and I've tried to follow a guide but ended up with a (not working) reversely configured proxy to the solution I want.

My web server is going to be making lots of API calls to several websites and so I'd like for it to cache those calls locally. I don't want incoming user traffic to go through the proxy.

I'm running Ubuntu 10.04LTS, with the latest version of Squid installed from apt.

I followed this:

http://www.ubuntugeek.com/how-to-setup- … buntu.html">http://www.ubuntugeek.com/how-to-setup-transparent-squid-proxy-server-in-ubuntu.html

But of course this ended in my requests to myserver.com hitting a squid error page.

Could anyone assist me configuring squid for my needs?

1 Reply

You want iptables to affect only outgoing traffic, so the ONLY iptables rule you should use is:

iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128

I'm no Squid expert so you may need to tweak the Squid settings as well, but this rule will at least get outbound HTTP traffic (and only outbound HTTP traffic) redirected towards Squid.

(Make sure you remember to remove the old iptables rules.)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct