simple configuration

Dridi Boukelmoune dridi.boukelmoune at zenika.com
Thu Jan 24 15:26:47 CET 2013


Hi,

You are right indeed.

Regards,
Dridi

On Wed, Jan 23, 2013 at 6:45 PM, Friedrich Locke
<friedrich.locke at gmail.com> wrote:
> May i replace obj by beresp in vcl_fetch ?
>
> Thanks.
>
> On Wed, Jan 23, 2013 at 3:14 PM, Dridi Boukelmoune
> <dridi.boukelmoune at zenika.com> wrote:
>> It looks like a varnish 2 VCL.
>>
>> Regards,
>> Dridi
>>
>> On Wed, Jan 23, 2013 at 6:11 PM, Friedrich Locke
>> <friedrich.locke at gmail.com> wrote:
>>> What i am trying is below (based on
>>> https://www.varnish-cache.org/trac/wiki/Introduction#Ourconfiguration)
>>> :
>>>
>>> sub vcl_recv {
>>>
>>>         set req.http.host = "www.centev.ufv.br";
>>>
>>>         set req.backend = centev;
>>>
>>>         if (req.request == "GET" && req.url ~ "^/static/") {
>>>                 unset req.http.cookie;
>>>                 unset req.http.Authorization;
>>>                 return (lookup);
>>>         }
>>>
>>>         if (req.request == "POST") {
>>>                 return (pass);
>>>         }
>>>
>>>         if (req.request != "GET" && req.request != "HEAD" &&
>>>             req.request != "PUT" && req.request != "POST" &&
>>>             req.request != "TRACE" && req.request != "OPTIONS" &&
>>>             req.request != "DELETE" ) {
>>>                 # Non-RFC2616 or CONNECT which is weird #
>>>                 return (pass);
>>>         }
>>>
>>>         if (req.http.Authorization) {
>>>                 # Not cacheable by default #
>>>                 return (pass);
>>>         }
>>>
>>>         return (lookup);
>>> }
>>>
>>> sub vcl_fetch {
>>>
>>>         if (req.request == "GET" && req.url ~ "^/static" ) {
>>>                 unset obj.http.Set-Cookie;
>>>                 set obj.ttl = 30m;
>>>                 return (deliver);
>>>         }
>>>
>>>         if (obj.status >= 300) {
>>>                 return (hit_for_pass);
>>>         }
>>>
>>>         if (!obj.cacheable) {
>>>                 return (hit_for_pass);
>>>         }
>>>
>>>         if (obj.http.Set-Cookie) {
>>>                 return (hit_for_pass);
>>>         }
>>>
>>>         if (obj.http.Pragma ~ "no-cache" ||
>>>             obj.http.Cache-Control ~ "no-cache" ||
>>>             obj.http.Cache-Control ~ "private") {
>>>                 return (hit_for_pass);
>>>         }
>>>
>>>         if (obj.http.Cache-Control ~ "max-age") {
>>>                 unset obj.http.Set-Cookie;
>>>                 return (deliver);
>>>         }
>>>
>>>         return (hit_for_pass);
>>> }
>>>
>>> Message from VCC-compiler:
>>> Symbol not found: 'obj.cacheable' (expected type BOOL):
>>> ('input' Line 176 Pos 14)
>>>         if (!obj.cacheable) {
>>> -------------#############---
>>>
>>> Running VCC-compiler failed, exit 1
>>>
>>> VCL compilation failed
>>> #
>>>
>>>
>>> Any advice ?
>>>
>>> PS: varnish-3.0.2
>>>
>>>
>>> On Wed, Jan 23, 2013 at 2:57 PM, Dridi Boukelmoune
>>> <dridi.boukelmoune at zenika.com> wrote:
>>>> Hi Friedrich,
>>>>
>>>> You cannot issue a pass in vcl_fetch, are you looking for hit_for_pass ?
>>>> https://raw.github.com/varnish/Varnish-Book/master/ui/img/vcl.png
>>>>
>>>> Regards,
>>>> Dridi
>>>>
>>>> On Wed, Jan 23, 2013 at 5:50 PM, Friedrich Locke
>>>> <friedrich.locke at gmail.com> wrote:
>>>>> Sorry,
>>>>>
>>>>> but i am getting this error too:
>>>>>
>>>>> Message from VCC-compiler:
>>>>> Invalid return "pass"
>>>>> ('input' Line 173 Pos 25)
>>>>>                 return (pass);
>>>>> ------------------------####--
>>>>>
>>>>>
>>>>> ...in subroutine "vcl_fetch"
>>>>> ('input' Line 164 Pos 5)
>>>>> sub vcl_fetch {
>>>>> ----#########--
>>>>>
>>>>>
>>>>> ...which is the "vcl_fetch" method
>>>>> Legal returns are: "deliver" "error" "hit_for_pass" "restart"
>>>>> Running VCC-compiler failed, exit 1
>>>>>
>>>>> VCL compilation failed
>>>>> #
>>>>>
>>>>>
>>>>> Have any ideia ?
>>>>>
>>>>> On Wed, Jan 23, 2013 at 11:57 AM, Enno van Amerongen <enno at tty.nl> wrote:
>>>>>> From: Shibashish [mailto:shib4u at gmail.com]
>>>>>> Subject: Re: simple configuration
>>>>>>
>>>>>>
>>>>>> On Wed, Jan 23, 2013 at 6:07 PM, Friedrich Locke <friedrich.locke at gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi folks,
>>>>>>>
>>>>>>> i have just installed varnish and this is my first message to the list.
>>>>>>> I did i very simple configuration. I edited /etc/varnish/default.vcl.
>>>>>>>
>>>>>>> I included the following lines:
>>>>>>>
>>>>>>> backend default {
>>>>>>>         .host = "aton.cpd.edu.br";
>>>>>>>         .port = "80";
>>>>>>> }
>>>>>>>
>>>>>>> I stress loaded the my site, now being served by varnish, but i
>>>>>>> noticed no performance improvement.
>>>>>>> I would like to do a minimal configuration just to see how fast
>>>>>>> varnish could do.
>>>>>>> Is there something more i need to configure in order to get the taste
>>>>>>> of varnish ?
>>>>>>
>>>>>> Yes, you need to check and fix the http headers your backend sends, by
>>>>>> default, Varnish honors them.
>>>>>>
>>>>>> https://www.varnish-cache.org/trac/wiki/Introduction#Ourconfiguration
>>>>>>
>>>>>> Enno
>>>>>
>>>>> _______________________________________________
>>>>> varnish-misc mailing list
>>>>> varnish-misc at varnish-cache.org
>>>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc



More information about the varnish-misc mailing list