normalizing ?ver= css and js

Andrzej Godziuk info at massivescale.net
Tue May 12 21:03:41 CEST 2015


On Tue, 12 May 2015 18:19:27 +0000 (UTC)
Miguel Gonzalez <miguel_3_gonzalez at yahoo.es> wrote:

> Dear all,
>   I have Varnish 4 installed, in vcl_recv I have added this line:
>   set req.url = regsub(req.url, "\?ver=.*$", "");
>   
>   which supposedly normalizes all css and js ?ver=xxxx strings. 
>    However tools.pingdom.com reports there are still css and js files
> being delivered with those strings. What am I doing wrong?
>   Thanks!  
>    Miguel
>   

Hi,

Adding this line to your configuration did not remove ?ver=xxx from
HTML produced by your application. You can't do it with Varnish (well,
technically you can do everything with Varnish but it would require a
fair amount of C programming).

You should fix your application to not produce such strings. 

What this snipped of VCL code does is it keeps a single copy of said
JS/CSS files, so that no matter what the value of xxx is, it's always
served from the same cache entry.

Andrzej Godziuk
http://massivescale.net/



More information about the varnish-misc mailing list