Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to setup Squid transparent proxy on my server. However, I also want to have Apache running. And HTTP/HTTPS should work on Apache as well as on proxy port.

So say:

  • Apache serves HTTP requests on port 80, HTTPS on 443
  • And I should have a proxy that supports HTTP and HTTPS.


  1. How do I set the above up?
  2. How do I configure any tools that take in proxy server address and port. Usually tools take only 1 port. Will my proxy be running on 2 different ports for HTTP/HTTPS?
share|improve this question

The standard port for squid is 3128. It supports HTTP, HTTPS, and other protocols on this port. It also supports a transparent HTTP proxy mode using a separate port. For a transparent proxy to work, you will need NAT rules to forward web traffic to the proxy. I Setup a Squid Transparent Proxy using both ports.

There is no conflict with your Apache server on 80 and 443. Do review the configuration so that you don't cache your local server. Normally you should exempt connections to your local server from passing though the transparent proxy.

EDIT: To operate as a transparent proxy for your users you will need to configure your firewall to forward all web requests not originating from your squid server to the squid server. In iptables this is done with a DNAT configuration. I use shorewall to build my firewall and have a rule like this. ($SQUID resolves to the IP address of my squid server.)

HTTP(DNAT)        loc             dmz:$SQUID:3129  -      -    -   !

You may also want to forward other ports commonly used for HTTP to squid. I forward the ports 81, 82, and 8080 among other to squid.

You may want to distribute your proxy configuration as I detailed in Setting up Squid Proxy on Ubuntu. This can handle HTTPS as well as HTTP.

share|improve this answer
Thanks. I am bit confused. All setup guides talk about forwarding traffic from port 80 to squid port. Will that not mean that I cannot run websites on my server? Basically what I need is something like this. -> a normal website running on the server, served through apache. --> a proxy server, that anyone can use. ( is not any website, but just a proxy server that I need) Does what is mentioned in the setup guide achieve this? – JPO Jul 20 '12 at 15:42
Yes you need to DNAT outgoing connections if you want to run a transparent proxy. (For IPv6 you likely just want to block access and force users to use the proxy.) – BillThor Jul 20 '12 at 23:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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