May 15, 2018 · CentOS Linux Squid

Setup Http/Https proxy on CentOS

sudo su
dhclient
yum update
yum install vim zip unzip tar git -y
yum install squid -y

echo "
cache_dir ufs /var/spool/squid 1000 16 256
cache_swap_low 90
cache_swap_high 95
via off
forwarded_for off

request_header_access Allow allow all 
request_header_access Authorization allow all 
request_header_access WWW-Authenticate allow all 
request_header_access Proxy-Authorization allow all 
request_header_access Proxy-Authenticate allow all 
request_header_access Cache-Control allow all 
request_header_access Content-Encoding allow all 
request_header_access Content-Length allow all 
request_header_access Content-Type allow all 
request_header_access Date allow all 
request_header_access Expires allow all 
request_header_access Host allow all 
request_header_access If-Modified-Since allow all 
request_header_access Last-Modified allow all 
request_header_access Location allow all 
request_header_access Pragma allow all 
request_header_access Accept allow all 
request_header_access Accept-Charset allow all 
request_header_access Accept-Encoding allow all 
request_header_access Accept-Language allow all 
request_header_access Content-Language allow all 
request_header_access Mime-Version allow all 
request_header_access Retry-After allow all 
request_header_access Title allow all 
request_header_access Connection allow all 
request_header_access Proxy-Connection allow all 
request_header_access User-Agent allow all 
request_header_access Cookie allow all 
request_header_access All deny all
" >> /etc/squid/squid.conf
# http_access allow localhost => http_access allow all
# http_access deny all 
systemctl restart squid
systemctl enable squid

#if you need to proxy request to internal server, just add it in /etc/hosts table

#After Added new /etc/hosts record, you can refresh

systemctl stop squid
/var/spool/squid
rm –rf /var/spool/squid/swap.state
systemctl start squid