Cached image's files by Mime-Type

Samuel Martin samuel.martin at makina-corpus.com
Mon Jan 14 17:31:46 CET 2008


Re,

First thanks for your response, you're right I was out ;-)

I re-read the vcl's man and i understand some details of the structure
of a vcl file so :

My first question : Vcl syntax has changed between old releases ?

My goal is to cache picture with or without extension :
So in my subroutine vcl_fetch I add :

if (resp.http.Content-Type ~ "image*") {
insert;
}

And I can't load varnish : Variable 'resp.http.Content-Type' not
accessible in method 'vcl_fetch'.
And I test with synthax seen in vcl examples (with another global
variables) and the same error appears !

Can I solve the problem ? What I miss ?

I test varnish under ubuntu os with a varnish 1.1.2 (and sometimes with
1.1.1)
>> but this declaration in my vcl file doesn't working ::
>>         if (req.http.header ~ "image*" ) {
>>                lookup;
>>         }
>>
>> contrary to ::
>>         if (req.url ~ "\.(css|js|gif|jpg|png|jpeg)$") {
>>                 lookup;
>>         }
>>
>> How i must interprete this ? Is my syntax bad or other ?
>>     
>
> You're trying to match the request headers to force a lookup, but the
> request does not include a content-type header.  That's something
> you'll find in the response headers.
> -- 
>   


More information about the varnish-test mailing list