Squid cannot cache static files with query string

cachesquid

I'm having an issue here.
i setup my router with squid transparent proxy and also to do static files caching.
It can cache static files successfully.
But it cannot cache static file with query string.
Example:
http://www.example.com/style.css => this will cache successfully
http://www.example.com/style.css?v=1.1 => this won't cache.

Does anyone know why and how to fix that?

Best Answer

The default configuration of Squid is to not cache dynamic content (which URLs with query strings are considered to be). That Squid wiki page explains how to change this. Basically you need to remove the following line from squid.conf:

cache deny QUERY

and replace it with these refresh patterns:

refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern .            0 20% 4320