Need some help understanding these headers -- *is* my file being cached, or not?

Bedis 9 bedis9 at gmail.com
Wed May 5 05:45:39 CEST 2010


Hi,

Your browser sends the "Cache-Control: no-cache", by default Varnish
will follow it and bypass the cache.
You can force caching that by using:
# Ignore Cache-Control header from the request
       if (req.http.Cache-Control ~ "no-cache") {
               unset req.http.Cache-Control;
       }
       if (req.http.Pragma ~ "no-cache") {
               unset req.http.Pragma;
       }

in vcl_recv

rgs


On Wed, May 5, 2010 at 3:13 AM, Ben DJ
<bendj095124367913213465 at gmail.com> wrote:
> I've got varnish setup to cache JS inbetween an nginx front-end (gzip
> compression only) & an apache2 backed serving content.
>
> On loading my page, here's the LiveHTTPHeader result for one particular file:
>
>                https://my.domain.com/srv/js/minified.1273021105.js
>
>
>
>                GET /srv/js/minified.1273021105.js HTTP/1.1
>
>                Host: my.domain.com
>
>                User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.4)
> Gecko/20100417
>
>                Accept: */*
>
>                Accept-Language: en-us,en;q=0.5
>
>                Accept-Encoding: gzip,deflate
>
>                Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>
>                Keep-Alive: 115
>
>                Connection: keep-alive
>
>                Referer: https://my.domain.com/
>
>>               Pragma: no-cache
>
>>               Cache-Control: no-cache
>
>
>
>                HTTP/1.1 200 OK
>
>                Server: nginx/0.8.35
>
>                Date: Wed, 05 May 2010 01:02:36 GMT
>
>                Content-Type: text/x-js
>
>                Transfer-Encoding: chunked
>
>                Connection: keep-alive
>
>                Vary: Accept-Encoding
>
>                Last-Modified: Wed, 05 May 2010 00:58:30 GMT
>
>                Etag: "19f3b-c911-485ce530d9980"
>
>>               X-Cacheable: NO: !obj.cacheable
>
>                X-Varnish: 199766821
>
>                Age: 0
>
>                Via: 1.1 varnish
>
>                X-Cache: MISS
>
>                Expires: Sat, 08 May 2010 01:02:36 GMT
>
>                Cache-Control: max-age=259200
>
>                Content-Encoding: gzip
>
>
> The three lines I've marked,
>
>        >               Pragma: no-cache
>
>        >               Cache-Control: no-cache
>
>        >               X-Cacheable: NO: !obj.cacheable
>
>
>
> Have me confused ... IIUC, and not sure I do, they seem to indicate
> the file's NOT being cached.
>
> I'm happy to provide my vcl.conf if helpful/necessary. b4 I go
> tromping though it again, can someone clarify what is, in fact,
> happening to that file, according to the headers above?  I'm clearly
> not 'fluent' enough in header-speak, yet ...
>
>
> Thanks,
>
> Ben
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>




More information about the varnish-misc mailing list