?Have you tried using the --include-params to set the params you want included in the key? Then you may have to add a --static-prefix= (empty space to wipe out the prefix) and --remote-path=true to also remove the path, hopefully just leaving you with the params you want as the key. You can enable the xdebug plugin and do curls with -H 'X-Debug: X-Cache-Key', to test and see how they turn out
________________________________ From: Brian Geffon <[email protected]> Sent: Monday, June 25, 2018 5:35 PM To: [email protected] Subject: [EXTERNAL] Re: How can I set partial value of a query parameter into cache key? If you don't mind coding you can write a C plugin that uses: TSCacheUrlSet: https://docs.trafficserver.apache.org/en/latest/developer-guide/cache-architecture/api-functions.en.html. Or you can also write a C++ plugin that uses Transaction.setCacheUrl(): https://github.com/apache/trafficserver/blob/master/lib/cppapi/include/atscppapi/Transaction.h#L272 On Mon, Jun 25, 2018 at 4:24 PM Chillin Gong <[email protected]<mailto:[email protected]>> wrote: I see. Thanks Jeremy! Will have a try to evaluate it later. Besides this option, does anyone has any other options? Regards, Chunlin Gong On Mon, Jun 25, 2018 at 4:13 PM, Jeremy Payne <[email protected]<mailto:[email protected]>> wrote: i dont know if there is a cache url lua script already written.. but if not, just follow examples in the below to write your own. https://docs.trafficserver.apache.org/en/7.1.x/admin-guide/plugins/ts_lua.en.html On Mon, Jun 25, 2018 at 6:02 PM, Chillin Gong <[email protected]<mailto:[email protected]>> wrote: > Hi Jeremy, > > Thanks for the reply! Do you mean there are some lua scripts that implement > the cache key feature, and they can be hooked into traffic server with lua > plugin? Do you have a sample lua script for it? > > > Regards, > Chunlin > > On Mon, Jun 25, 2018 at 3:56 PM, Jeremy Payne > <[email protected]<mailto:[email protected]>> wrote: >> >> If you're open, you'll find what you're looking for in the lua plugin. >> >> >> >> On Mon, Jun 25, 2018 at 12:02 PM, Chillin Gong >> <[email protected]<mailto:[email protected]>> >> wrote: >> > Hi, >> > >> > I am a new user of traffic server. Recently I am trying to migrate a >> > product >> > from ATS5 to latest ATS7. In ATS5, we use the cache feature, and use the >> > cacheurl plugin and regular expressions to extract partial value of a >> > query >> > parameter to comprise the cache key. However, I didn't find >> > corresponding >> > feature in ATS7 cachekey plugin to get partial value of a query >> > parameter. >> > >> > For example, our request url is something like >> > "/my/path?kw=test&geo=<country>,<state>,<city>,<street>". In ATS5, we >> > can >> > get "geo=<country>,<state>,<city>" (without <street>) as our cache key. >> > However, I didn't find similar syntax to get such partial value with >> > cachekey plugin in ATS7. >> > >> > https://docs.trafficserver.apache.org/en/7.0.x/admin-guide/plugins/cachekey.en.html >> > >> > Does anyone know how I can achieve similar feature with cachekey plugin >> > or >> > other plugins? >> > >> > >> > Thanks, >> > Chunlin Gong >> > >> > > >
