/varnish-urlsort

Varnish URL sort

Primary LanguageCOtherNOASSERTION

Contents:

./main  - the urlsort program with main() for cli use and as embedded varnish C code 
./vmod  - the urlsort program as a Varnish module

Building the module (the RST2MAN is optional):
cd vmod
VARNISHSRC=~/Source/varnish-3.0.2 VMODDIR=/usr/local/lib/varnish/vmods/ RST2MAN=/opt/local/bin/rst2man-2.7.py ./configure
make
sudo make install

Add to default.vcl:
include "urlsort.vcl";

And copy urlsort.vcl to your varnish directory:
cp urlsort.vcl /usr/local/etc/varnish

If you want an easy way to see if you had a cache hit or miss,
add the following to default.vcl:

sub vcl_deliver {
 
  if (obj.hits > 0) {
    set resp.http.X-Varnish-Cache = "HIT";
  }
  else {
    set resp.http.X-Varnish-Cache = "MISS";
  }
 
  return (deliver);
}

Restart varnish:
sudo killall varnishd 
sudo varnishd -f /usr/local/etc/varnish/default.vcl