formatted:: does it possible with varnish and how to do it

Per Buer perbu at varnish-software.com
Tue Mar 22 10:14:14 CET 2016


On Fri, Mar 18, 2016 at 10:15 AM, Швабауэр Павел <shvabauer at arsenal-d.uz>
wrote:

> Good day team,
> I'm using varnish in our projects already long time, so thank you very
> much for this great technology!
> Let me explain 1 thing I can't realize already 2 weeks.
>
> so, here is task. Please take a look, we are using some sort of security
> in links, so every client has own generated links.




> (..)
>

> # The data on which the hashing will take place
> sub vcl_hash {
>   ###### here we should modify url to try to return from cache
>   if (req.url ~ "/book/$") {
>     set req.http.cacheurl = regsub(req.url, "(.*)/(.*)/(.*)/(.*)$",
> "\1/\4");
>     std.log("hash rewrite was:" + req.url);
>     std.log("become ::: "+req.http.cacheurl);
>   } else {
>     set req.http.cacheurl = req.url;
>   }
>   hash_data(req.http.cacheurl);
>
>   if (req.http.host) {
>     hash_data(req.http.host);
>   } else {
>     hash_data(server.ip);
>   }
> }
>

Here you hand over control to the builtin VCL. The builtin VCL will add
req.url to the hash, which will more or less disable the caching.

If you return(lookup) in vcl_hash you will stop processing.

-- 
*Per Buer*
CTO | Varnish Software AS
Cell: +47 95839117
We Make Websites Fly!
www.varnish-software.com
<http://info.varnish-software.com/signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20160322/8bb3c966/attachment.html>


More information about the varnish-misc mailing list