From samuel.martin at makina-corpus.com Fri Jan 11 16:53:49 2008 From: samuel.martin at makina-corpus.com (Samuel Martin) Date: Fri, 11 Jan 2008 17:53:49 +0100 Subject: Cached image's files by Mime-Type Message-ID: <47879F1D.4010809@makina-corpus.com> Hello, I'm trying to cache image by Mime-Type because behind varnish i've a Zope/Plone architecture with some pictures without extension. 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 ? Thanks From ssm at linpro.no Mon Jan 14 08:14:31 2008 From: ssm at linpro.no (Stig Sandbeck Mathisen) Date: Mon, 14 Jan 2008 09:14:31 +0100 Subject: Cached image's files by Mime-Type In-Reply-To: <47879F1D.4010809@makina-corpus.com> (Samuel Martin's message of "Fri, 11 Jan 2008 17:53:49 +0100") References: <47879F1D.4010809@makina-corpus.com> Message-ID: <7xfxx0vn6g.fsf@iostat.linpro.no> Samuel Martin writes: > 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. -- Stig Sandbeck Mathisen, Linpro From samuel.martin at makina-corpus.com Mon Jan 14 16:31:46 2008 From: samuel.martin at makina-corpus.com (Samuel Martin) Date: Mon, 14 Jan 2008 17:31:46 +0100 Subject: Cached image's files by Mime-Type In-Reply-To: <7xfxx0vn6g.fsf@iostat.linpro.no> References: <47879F1D.4010809@makina-corpus.com> <7xfxx0vn6g.fsf@iostat.linpro.no> Message-ID: <478B8E72.7050006@makina-corpus.com> 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. > -- > From des at linpro.no Mon Jan 21 22:14:27 2008 From: des at linpro.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Mon, 21 Jan 2008 23:14:27 +0100 Subject: Cached image's files by Mime-Type In-Reply-To: <478B8E72.7050006@makina-corpus.com> (Samuel Martin's message of "Mon, 14 Jan 2008 17:31:46 +0100") References: <47879F1D.4010809@makina-corpus.com> <7xfxx0vn6g.fsf@iostat.linpro.no> <478B8E72.7050006@makina-corpus.com> Message-ID: Samuel Martin writes: > if (resp.http.Content-Type ~ "image*") That's not a valid regex (well, it is, but it doesn't do what you think) > And I can't load varnish : Variable 'resp.http.Content-Type' not > accessible in method 'vcl_fetch'. Because there is no resp in vcl_fetch in 1.1; it's called obj. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no From des at linpro.no Mon Jan 21 22:15:22 2008 From: des at linpro.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Mon, 21 Jan 2008 23:15:22 +0100 Subject: Cached image's files by Mime-Type In-Reply-To: (Dag-Erling =?utf-8?Q?Sm?= =?utf-8?Q?=C3=B8rgrav's?= message of "Mon, 21 Jan 2008 23:14:27 +0100") References: <47879F1D.4010809@makina-corpus.com> <7xfxx0vn6g.fsf@iostat.linpro.no> <478B8E72.7050006@makina-corpus.com> Message-ID: BTW, varnish-test is for testing the mailing lists. In the future, please ask your questions on varnish-misc. DES -- Dag-Erling Sm?rgrav Senior Software Developer Linpro AS - www.linpro.no