How to ignore chars after question mark in URL?
Jonathan Matthews
contact at jpluscplusm.com
Tue Apr 3 19:39:21 CEST 2012
On 3 April 2012 15:25, Kurt Kraut <listas at kurtkraut.net> wrote:
> Hi,
>
> I need to cache URLs of the same file but the front-end developer generates
> a random string, e.g.:
>
> www.kurtkraut.net/index.css?234234432
> www.kurtkraut.net/index.css?654323256
> www.kurtkraut.net/index.css?905837831
>
> How can I get a HIT for www.kurtkraut.net/index.css not matter the presence
> or not of the question mark and the random string after the question mark?
> Is it possible to ignore the presence of the question mark and the rest of
> the URL?
In my experience, developers often do this deliberately as a method of
versioning their CSS and JS. They'll append a "random" string (often a
unix timestamp) at deployment time, rendering that particular version
of the resource cachable until the next deployment.
Are you absolutely sure that this isn't what your devs are doing?
Because if they are, you'd be doing *exactly* the wrong thing by
explicitly ignoring the query-string, and may well break the
application during a random deploy, sometime in the future. But
possibly not during *each* deployment, leading to nicely intermittent
bug reports depending on the amount each CSS/JS has changed, and the
state of the user's browser cache :-)
HTH,
Jonathan
--
Jonathan Matthews
London, Oxford, UK
http://www.jpluscplusm.com/contact.html
More information about the varnish-misc
mailing list