[Varnish] #79: force nocache of objects

Varnish varnish-bugs at projects.linpro.no
Tue Jan 23 10:06:11 CET 2007


#79: force nocache of objects
----------------------+-----------------------------------------------------
 Reporter:  hmn       |        Owner:  des     
     Type:  defect    |       Status:  assigned
 Priority:  normal    |    Milestone:          
Component:  varnishd  |      Version:  trunk   
 Severity:  normal    |   Resolution:          
 Keywords:            |  
----------------------+-----------------------------------------------------
Changes (by des):

  * status:  new => assigned
  * owner:  phk => des

Old description:

> What are the correct cache headers to set if I need to tell varnish not
> to cache a file.
>
> Right now I use :
>
> Pragma: no-cache
> Cache-Control: s-maxage=0, max-age=0, must-revalidate, no-cache
>
> But sometimes I get some other users cached file, and it seems to be when
> I try to get a file in the exact same moment as som eother user.
>
> In vcl i have the following code to allow caching af some of the files
> even though a user is logged in.
>
>         # force lookup even when cookies are present
>         if (req.request == "GET" && req.http.cookie) {
>                 lookup;
>         }
>
> And when i request the file I get the following in varnishlog
>
>    15 VCL_call     c recv
>    15 VCL_return   c lookup
>    15 VCL_call     c miss
>    15 VCL_return   c fetch
>
>    16 RxHeader     b Pragma: no-cache
>    16 RxHeader     b Cache-Control: s-maxage=0, max-age=0, must-
> revalidate, no-cache
>    16 RxHeader     b Expires: Fri, 05 Jan 2007 08:57:03 GMT
>    16 RxHeader     b Content-Length: 1555
>    16 RxHeader     b Connection: close
>    16 RxHeader     b Content-Type: text/javascript
>    15 TTL          c 277100755 RFC 0 1168592154 1168592223 1167987423 0 0
>    15 VCL_call     c fetch
>    15 VCL_return   c insert
>
> Could it be the insert that is made by varnish that is the problem ?

New description:

 What are the correct cache headers to set if I need to tell varnish not to
 cache a file.

 Right now I use :

 {{{
 Pragma: no-cache
 Cache-Control: s-maxage=0, max-age=0, must-revalidate, no-cache
 }}}

 But sometimes I get some other users cached file, and it seems to be when
 I try to get a file in the exact same moment as som eother user.

 In vcl i have the following code to allow caching af some of the files
 even though a user is logged in.

 {{{
         # force lookup even when cookies are present
         if (req.request == "GET" && req.http.cookie) {
                 lookup;
         }
 }}}

 And when i request the file I get the following in varnishlog

 {{{
    15 VCL_call     c recv
    15 VCL_return   c lookup
    15 VCL_call     c miss
    15 VCL_return   c fetch

    16 RxHeader     b Pragma: no-cache
    16 RxHeader     b Cache-Control: s-maxage=0, max-age=0, must-
 revalidate, no-cache
    16 RxHeader     b Expires: Fri, 05 Jan 2007 08:57:03 GMT
    16 RxHeader     b Content-Length: 1555
    16 RxHeader     b Connection: close
    16 RxHeader     b Content-Type: text/javascript
    15 TTL          c 277100755 RFC 0 1168592154 1168592223 1167987423 0 0
    15 VCL_call     c fetch
    15 VCL_return   c insert
 }}}

 Could it be the insert that is made by varnish that is the problem ?

Comment:

 Reformatted the original message.

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/79>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list