How to Disable Squid Caching While Maintaining Web Filtering with Qlproxy


12 views

When using Squid as a proxy server with Qlproxy for web filtering, you might encounter excessive memory usage due to Squid's default caching mechanism. On systems with limited RAM (like your 640MB server), this can cause performance issues.

Here's the essential squid.conf modifications to completely disable caching:

# Disable disk caching
cache_dir null /tmp

# Disable memory caching
cache_mem 0 MB

# Set maximum object size to 0
maximum_object_size 0 KB

# Never store any responses
cache deny all

# Ensure no caching headers are added
cache_effective_user nobody
cache_effective_group nogroup

To ensure Squid properly forwards all traffic to Qlproxy without interference:

# Configure Qlproxy as ICAP server
icap_enable on
icap_service service_req reqmod_precache icap://127.0.0.1:1344/reqmod
adaptation_access service_req allow all

# Disable Squid's native filtering
url_rewrite_program none
url_rewrite_children 0

If you're considering alternatives to Squid+Qlproxy for web filtering on resource-constrained systems:

  • DansGuardian: Lighter than Squid for filtering-only setups
  • Privoxy: Simple HTTP filtering proxy
  • nginx + Lua: For custom filtering solutions

Additional configuration to reduce memory usage:

# Reduce memory buffers
memory_pools off
memory_replacement_policy lru

# Limit concurrent connections
max_filedescriptors 1024

Check your configuration with:

squid -k parse
squid -k check

Then monitor with:

squidclient mgr:info | grep cache
squidclient mgr:mem | grep store

When implementing web filtering solutions like Qlproxy (Quintolabs) alongside Squid proxy, administrators often need to optimize resource usage - especially on low-memory systems (like your 640MB RAM server). The primary challenge involves:

  • Preventing Squid from caching responses unnecessarily
  • Ensuring clean pass-through to the filtering system
  • Maintaining proxy functionality while reducing memory overhead

Here's the optimal squid.conf configuration for your use case:


# Disable disk caching completely
cache_dir null /tmp

# Set memory cache to minimal footprint
cache_mem 1 MB
maximum_object_size_in_memory 1 KB

# Important: Disable all caching behaviors
cache deny all
range_offset_limit -1
quick_abort_min -1

For proper Qlproxy integration while avoiding caching, add these critical directives:


# Configure Qlproxy as ICAP server
icap_enable on
icap_service service_req reqmod_precache icap://127.0.0.1:1344/reqmod
adaptation_access service_req allow all

# Bypass caching for filtered content
acl filtered_content resp_mod tag=*
always_direct allow filtered_content

Additional parameters for memory-constrained environments:


# Reduce memory buffers
reply_body_max_size 0
maximum_object_size 1 KB

# Optimize connection handling
pconn_timeout 120 seconds
client_persistent_connections off
server_persistent_connections off

If you're considering alternatives to the Squid+Qlproxy combination:

  • Privoxy: Lightweight filtering proxy (no caching by default)
  • DansGuardian: Standalone content filtering solution
  • Nginx with LUA filters: More modern proxy with filtering modules

To confirm caching is disabled:


squidclient -p 3128 mgr:info
# Look for "Storage Swap size: 0 KB" in output

# Check hit ratio (should be 0.00)
squidclient -p 3128 mgr:5min