Squid Proxy: Why Nothing is Cached After Enabling or Disabling

Abstract: Resolve Squid Proxy caching failures by fixing directory permissions, correcting cache_dir configuration, and addressing restrictive origin server headers.

Created: 2026-10-11 by

Squid Proxy appears to cache nothing because the cache directory lacks proper permissions, the storage size is insufficient, or the cache_dir directive is misconfigured. Additionally, HTTP headers from the origin server may explicitly forbid caching via no-store or private directives. Verifying ownership of the cache folder and reviewing squid.conf settings usually resolves this immediate performance stagnation.

Verifying Cache Directory Permissions

The most common reason for Squid failing to write cached objects is a permission error on the disk location designated for storage. If the user running the Squid process does not have read and write access to the cache directory, Squid silently fails to store data, forcing every request to hit the origin server. This results in identical download times regardless of whether the proxy is active or not. You must ensure that the cache directory is owned by the correct system user. By default, Squid often runs as the proxy or nobody user, depending on your Linux distribution configuration. To check the current ownership, use the ls -ld command on your cache path. If the owner is not set correctly, you can change it using the chown command. For example:
sudo chown -R proxy:proxy /var/spool/squid
After correcting ownership, you should restart the Squid service to apply the changes. On systems using systemd, this is done via sudo systemctl restart squid. Always verify that the directory exists and has adequate space before proceeding to other configurations.

Configuring the Cache Directory Correctly

The cache_dir directive in squid.conf defines where cached objects are stored. A misconfigured or commented-out line here will disable caching entirely. The standard syntax requires specifying the filesystem type, the absolute path, the initial size in megabytes, and the first-level and second-level directory names. A typical valid configuration looks like this:
cache_dir ufs /var/spool/squid 100 16 256
In this example, ufs is the filesystem type, /var/spool/squid is the path, 100 is the initial size, 16 is the number of first-level subdirectories, and 256 is the number of second-level subdirectories per first-level directory. If any of these parameters are missing or incorrect, Squid may fail to initialize the cache store. If you recently changed the cache path, you must run the squid -z command to create the necessary directory structure. This command initializes the cache directories according to the parameters in squid.conf. Without running squid -z, the directories will not exist, leading to silent failures during runtime.

Checking Origin Server Headers

Even with perfect Squid configuration, caching will not occur if the origin server sends headers that prohibit it. Web servers often send Cache-Control: no-store, Cache-Control: private, or Expires headers to indicate that content should not be cached. This is common for dynamic content, login pages, or sensitive data. To diagnose this, inspect the response headers of the URLs you are trying to cache. You can use browser developer tools or command-line tools like curl to view these headers. Look for the Cache-Control field. If it contains no-store, Squid is obeying the server's instructions to avoid storing the object. If you need to cache specific resources despite these headers, you can modify Squid’s behavior using acl rules and cache_control directives. However, altering these settings may expose users to stale data or security risks if applied too broadly. It is generally better to configure the origin server to allow caching for static assets rather than overriding its policies at the proxy level.

Monitoring Cache Activity

Once permissions and configuration are verified, monitor the cache to confirm it is working. Use the squidclient mgr:info command to view detailed statistics about cache hits and misses. A healthy cache will show a non-zero number of cached objects and a decreasing miss ratio over time. Another useful tool is squidclient mgr:store_object_list, which lists objects currently in the cache. If this list remains empty after browsing various sites, the issue likely persists in the configuration or permissions. You can also check the access.log file for entries indicating why specific requests were not cached. Logs often provide clear reasons such as "Not Cachable" due to header restrictions. For more granular control, consider setting up regular cache clearing intervals. While not directly related to the initial failure, maintaining a clean cache can prevent issues with corrupted objects. See our guide on Way to Clear Cache Regular Intervals without Application for best practices on maintenance.

Common Pitfalls in Multi-User Environments

In environments where multiple users share a single Squid instance, conflicts can arise if different users attempt to modify the cache directory simultaneously. Ensure that only the Squid process writes to the cache directory. User accounts should not have direct write access to /var/spool/squid or whatever path you have defined. Additionally, check for SELinux or AppArmor profiles that might block Squid from writing to new locations. If you moved the cache to a non-standard directory, you may need to update your security context labels. Use getsebool -a | grep squid to check relevant SELinux booleans and enable them if necessary.

Frequently Asked Questions

How do I force Squid to ignore cache-control headers?

You can override these headers using the always_direct and never_direct directives combined with ACLs, but this is risky. A safer approach is to use cache_replacement_policy to manage how objects are evicted when space is low. Overriding headers can lead to serving outdated or sensitive information to users.

Why does my cache size stay at zero even after restarting?

This usually indicates that the cache_dir path is incorrect or inaccessible. Verify that the directory exists and that the Squid user has full read-write-execute permissions. Also, ensure that SELinux or AppArmor is not blocking access to the directory.

Can I cache HTTPS traffic with Squid?

Squid can cache HTTPS traffic if configured as an SSL-Bump proxy, but this requires installing certificates and configuring SSL interception rules. Standard forward proxy mode does not decrypt HTTPS traffic, so it cannot cache the content inside the encrypted tunnel. This setup adds significant complexity and potential privacy concerns.

What is the best cache replacement policy for large caches?

For large caches, the heap LFUDA (Least Frequently Used with Dynamic Aging) policy is often recommended. It balances recency and frequency of access, making it suitable for diverse workloads. You can set this in squid.conf using cache_replacement_policy heap LFUDA.

How do I check if Squid is actually running?

Use systemctl status squid to check the service status. You can also use netstat -tlnp | grep :3128 to verify that Squid is listening on its default port. If the service is inactive, start it with systemctl start squid and check the error log for startup failures.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More