AW: caching everything incl. 403?

Neil.Scholten at scoyo.com Neil.Scholten at scoyo.com
Sun Dec 21 14:18:56 CET 2008


Hi,

It doesn't work :/

sub vcl_fetch {
		
	/* Set NON-200 caching */
	if (obj.status != 200)
	{
		set obj.cacheable = "1";
		set obj.ttl = 300s;
	}
	[...]

Error-Message:

Expected ID got '"1"'
(program line 290), at
(/etc/varnish/default.vcl Line 20 Pos 37)
                set obj.cacheable = "1";
------------------------------------###-

VCL compilation failed

Any idea?

--neil

-----Ursprüngliche Nachricht-----
Von: varnish-misc-bounces at projects.linpro.no [mailto:varnish-misc-bounces at projects.linpro.no] Im Auftrag von Tollef Fog Heen
Gesendet: Dienstag, 16. Dezember 2008 16:43
An: varnish-misc at projects.linpro.no
Betreff: Re: caching everything incl. 403?

]] "Loesche, Lukas, scoyo" 

| Also, what criteria has to be meet for if(obj.cacheable) to be true?

from bin/varnishd/rfc2616.c:

        switch (sp->obj->response) {
        case 200: /* OK */
        case 203: /* Non-Authoritative Information */
        case 300: /* Multiple Choices */
        case 301: /* Moved Permanently */
        case 302: /* Moved Temporarily */
        case 410: /* Gone */
        case 404: /* Not Found */
                sp->obj->cacheable = 1;
                [...]
        default:
                sp->obj->cacheable = 0;

In other words, by default it'll be marked as non-cacheable. You should
be able to do something like:

if (obj.status == 403) {
   set obj.cacheable = 1;
}

in your VCL.

-- 
Tollef Fog Heen 
Redpill Linpro -- Changing the game!
t: +47 21 54 41 73
_______________________________________________
varnish-misc mailing list
varnish-misc at projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc



More information about the varnish-misc mailing list