[varnish] Re: [varnish] Re: Handling of cache-control
pablort
pablort+varnish at gmail.com
Thu Jan 28 00:00:03 CET 2010
Isn't this the equivalent of and max-age=5 and s-maxage=0 ?
On Wed, Jan 20, 2010 at 7:19 AM, Bedis 9 <bedis9 at gmail.com> wrote:
> Hi,
>
> Netcache devices had the X-Accel-Cache-Control headers in order to
> allow an origin server to setup different Cache-Control parameters for
> the cache and the end-user.
> The netcache will follow the X-Accel-Cache-Control while the end user
> will follow the Cache-Control.
>
> I've a few customer using this, mainly for sports events where "live"
> is the key.
> They setup X-Accel-Cache-Control to max-age=5 while Cache-Control is
> set to no-cache.
> That way, all the load generated by thousends of request per second
> for "live" stuff is offloaded to the cache layer.
> Only a few request goes back to the origin.
>
>
> I was able to reproduce such behavior with the following inline C:
> sub vcl_fetch {
> [...]
> # Check if X-Accel-Cache-Control exists and follow it
> if (obj.http.X-Accel-Cache-Control) {
> C{
> char *cache;
> int max_age = 0;
> cache = VRT_GetHdr(sp, HDR_OBJ, "\026X-Accel-Cache-Control:");
> if(cache) {
> char *s = NULL;
> /* Looking for max-age */
> if (s = strstr(cache, "max-age=")) {
> s+=8;
> max_age = strtoul(s, 0, 0);
> if (max_age) {
> VRT_l_obj_ttl(sp, max_age);
> }
> }
> }
> }C
> unset obj.http.X-Accel-Cache-Control;
> }
>
> # Cache-Control and Pragma headers preventing caching
> if ((!obj.http.X-Accel-Cache-Control) && (obj.http.Pragma ~
> "no-cache" || obj.http.Cache-Control ~ "(no-cache|no-store|private)"))
> {
> pass;
> }
>
> }
>
> [...]
>
> }
>
>
> Maybe it can be useful to somebody else :)
>
> cheers
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100127/9b3cc96d/attachment-0001.html>
More information about the varnish-misc
mailing list