Squid

How to enable GZIP compression for Squid?

Installation:
  • Download/clone squid-ecap-gzip
  • apt-get install g++ libecap3-dev zlib1g-dev pkg-config
  • ./configure && make all install – will install the library to /usr/local/lib

Below information is obsolete

I get ERROR: No forward-proxy ports configured in /var/log/squid/cache.log

From No forward-proxy ports error in 3.3:

Squid needs at least one port to serve the error page, FTP and gopher icons, and other proxy-proxy communications from:

  1. When producing an error page there are CSS embedded images(s).
  2. When generating FTP directory listing there are icons for each file on the list.
  3. The cachemgr.cgi API can be accessed via HTTP or HTTPS protocol through this port.
  4. URLs inside any HTML manager reports may use this port to target particular worker for servicing a request.
  5. To exchange traffic between proxy peers a forward-proxy port is required by cache_peer as the http-port option. This gets used for all traffic fetched through that peer, including cache digests, netdb exchanges and background live/dead monitoring probes.

Interception port mode now (3.2+) has security checks which cause problems for that traffic. The solution is to have Squid configured with forward-proxy port and transparent-proxy port:

/etc/squid/squid.conf

http_port 3128
http_port 3129 intercept

and then (provided that internal network is connected via eth2 interface) forward the traffic to that port:

iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j REDIRECT --to-port 3129

If eth2 is bridged, then use (see Using the iptables physdev match module):

iptables -t nat -A PREROUTING -p tcp -m physdev --physdev-in eth2 --dport 80 -j REDIRECT --to-port 3129

It is advised to close the interception port for direct access (it is important to perform it before nat table, as otherwise it will be blocked also for port forwarding):

iptables -t mangle -A PREROUTING -p tcp --dport 3129 -j DROP

Squid exits with the log message Too few redirector processes are running

From squidGuard errors - too few redirectors:

When more then 50% of redirector helpers have crashed, Squid will shut down.

How to format squid log timestamps?

$ cat /var/log/squid/access.log | perl -p -e 's/^([0-9]*)/"[".localtime($1)."]"/e' | less

software/squid.txt · Last modified: 2015/10/05 17:30 by dmitry
 
 
Recent changes RSS feed Driven by DokuWiki