How to allow users to access the caches at specific times using Squid proxy server

To allow users to access the caches at specific times using Squid proxy server

Squid is a proxy caching server. An HTTP proxy server is a program that accepts requests from clients for URLs and fetches them for the client and displays the results to the client. A proxy is also used for caching commonly requested pages so that it may retrieved for the users for future uses. In this tutorial we will be briefed about the explanation on how to allow some users to use the cache at specific time duration using Squid proxy server on CentOS 6.7.

Configuration procedure

To start the configuation procedure, check the status of Squid service.

[root@server3 ~]# service squid status

Create a file named sites.txt and enter the websites name that had to be blocked. Save and exit the file.

[root@server3 ~]# vim /etc/squid/sites.txt
www.facebook.com
www.flipkart.com
www.youtube.com

Add the following ACL rule in squid configuration file using vim editor and make the following changes. Save and exit the file.

[root@server3 ~]# vim /etc/squid/squid.conf
acl users src 192.168.7.206 192.168.7.216
acl access dstdomain " /etc/squid/sites.txt" 
acl break time 06:17-06:20
http_access allow users access break
http_access deny users access

Reload the Squid service by executing the following command.

[root@server3 ~]# service squid reload

To check the configuration of the Squid. Switch over to the browser and try to access the blocked site. The following error page will be displayed.


After the given time duration in Squid configuration file elapses, try to access the blocked sites. The blocked sites can be access without any glitches.

Thus conclues the configuration procedure of allowing some users to use the cache at specific time duration using Squid proxy server on CentOS 6.7.

FAQ
Q
What is squid configuration file?
A
The squid configuration file is as follows
# /etc/squid/squid.conf
Q
What is squid Proxy server?
A
Squid is a proxy caching server. An HTTP proxy server is a program that accepts requests from clients for URLs and fetches them for the client and displays the results to the client.
Q
Why am I getting ``Proxy Access Denied?''
A
You may need to set up the http_access option to allow requests from your IP addresses. Please see the Access Controls section for information about that.
Q
I can't get local_domain to work; Squid is caching the objects from my local servers?
A
The local_domain directive does not prevent local objects from being cached. It prevents the use of sibling caches when fetching local objects.
Q
Cannot bind socket FD NN to *:8080 (125) Address already in use?
A
This means that another process is already listening on port 8080 (or whatever you're using). It could mean that you have a Squid process already running, or it could be from another program