SV: VCL language

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Mar 30 14:12:01 CEST 2006


In message <6AD33D89A21F7B479107D712EF96FDA52EF406 at VG-EXC-VIR-1.Akersgt.local>, "Anders Berg" writes:

>> So with those changes it would look like this:
>> 
>> 1     backend default {
>> 2         set backend.ip = 10.0.0.1;
>> 3     }
>> 4
>> 5     proc main {
>> 6	  if (req.request != "GET" && req.request != "HEAD") {
>> 7	      pass_through;
>> 8	  }
>> 9	  lookup_object;
>> 10	  if (obj.valid) {
>> 11            finish;
>> 12	  }
>> 13	  fetch;
>> 14        if (obj.suffix = ".hbs") {
>> 15            obj.ttl = 5m;
>> 16        } if (obj.content_type ~ "image/") {
>> 17            obj.ttl = 1w;
>> 18        } elif (obj.url ~ "/poor_written") {
>> 19            obj.ttl = 5m;
>> 20        }
>> 21	  if (obj.cacheable) {
>> 22	      insert;
>> 23	  }
>> 24    }
>
>This looks good, apart from 1 thing.
>
>21 if (obj.cacheable) {
>22	      insert;
>23	  }
>
>I guess most appications have a Expires header either they are right or
>not. So while obj.cacheable is good and we should keep it, we need maybe
>1 more.
>So I would suggest a 
>
>21 if (obj.url ~ "/nicely_written"){
>22    trust_header;
>23 }


Hmm, I think that by default we should expect non-broken behaviour, so
I would rather have a "disregard_headers" sort of escape than having to
explicitly mark backends which actually do work correctly.

Maybe I'm naïve here :-)

>Good work. This problem could maybe just be a semantic and
>implementation challange.

Yes, I rather think so, I don't think there is any doubt about the basic
VCL idea being the right way to go, it's just a matter of getting the
actual language optimized for expressing what people want to say.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-dev mailing list