trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Hedstrom <>
Subject Re: Removing few query strings from cache key
Date Sat, 14 Mar 2015 01:38:22 GMT

> On Mar 13, 2015, at 6:48 PM, Steve Malenfant <> wrote:
> Thanks Leif,
> I tried cacheurl, didn't work for me so far.
> regex_remap, need to check but I probably would need an example.
> I also found header_rewrite which has some "rm-header". A nice complement would be "rm-querystring"
which would make this too easy. But that's a "header" plugin.
> Lua seems the best option, at least the easiest for me.

A simple rule like this one for would suffice

.  http://$t/$P <http://$t/$P>

You would use this in remap.config, like

map <> <> @pparam=strip_query.conf

More docs to decipher this is available at <>

But, basically, this rewrites the URL to be just

	$t - The host as used in the "to" portion of the remap rule
	$P - The entire path of the request

Now, bear in mind that this removes the query parameters from the URL as seen by the origin
server. I don’t know if that’s the intent. Also, if you want something more intelligent
as you described in the first email, you’d have to create appropriate regexes to match the
groups of query parameters you wish to retain. The regexes and group expansion ($0-$9) are
Perl compatible.

I hope this helps?

— Leif

> I can see some enhancement to the url_sig since I would like to use in conjunction with
it. Remove the keys related to the signature, remove the rest or keep some. But then there
is the cases where you don't have signatures and need to manipulate query string.
> Steve
> On Fri, Mar 13, 2015 at 7:48 PM, Leif Hedstrom < <>>
> It really depends on whether you want the origin server to see the query parameters or
not. Both plugins ought to work as far as the cache key goes, but they behave differently
for the origin side.
> My preference is to modify the request URL in remap when possible. The API to modify
the cache key, as used by cacheurl plugin, is pretty inefficient. I'd have to check the regex_remap
to see if it does what you want . I'm pretty sure the Lua plugin can do this with a small
amount of Lua script.
> -- Leif
> > On Mar 13, 2015, at 1:01 PM, Steve Malenfant < <>>
> >
> > I'm trying to find the best way to remove part of the Query String for cache reasons.
Either exclude everything except (x, y and z) or include everything except (x, y and z)
> >
> > Seems like the CacheURL Plugin is how you would get this done. Seems like regex_remap
could do something similar but not exactly how you would achieve the results I wanted.
> >
> > Thanks,
> >
> > Steve

View raw message