DownStream Varnish Config

70 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

Rafael El Mago

nieprzeczytany,
28 mar 2016, 04:36:2428.03.2016
do mod-pagespeed-discuss
Guys,

Varnish 4 Downstream VLC needs an update.

sub vcl_hit {
 
# 5% of the time ignore that we got a cache hit and send the request to the
 
# backend anyway for instrumentation.
 
if (std.random(0, 100) < 5) {
   
set req.http.PS-ShouldBeacon = <your-secret-key>;
   
return (pass);
 
}
}
sub vcl_miss {
 
# Instrument 25% of cache misses.
 
if (std.random(0, 100) < 25) {
   
set req.http.PS-ShouldBeacon = <your-secret-key>;
   
return (pass);
 
}
}

The line:

set req.http.PS-ShouldBeacon = <your-secret-key>;

Should be:

set req.http.PS-ShouldBeacon = "<your-secret-key>";

Thanks

Rafael
magician


Wiadomość została usunięta

Rafael El Mago

nieprzeczytany,
28 mar 2016, 04:56:5828.03.2016
do mod-pagespeed-discuss
Not a Header Expert but is their a reason that my Expires Header is set to 1981?

Or should I set i to "0"?

Example?
#Mark HTML as uncacheable.  If we can't send them purge requests they can't
# cache our html.

if (beresp.http.Content-Type ~ "text/html") {
     unset beresp.http.Cache-Control;
     set beresp.http.Cache-Control = "no-cache, max-age=0";
unset beresp.http.expires;
set beresp.http.expires = "0";
   }

Joshua Marantz

nieprzeczytany,
29 mar 2016, 12:55:3829.03.2016
do mod-pagespeed-discuss
Added https://github.com/pagespeed/mod_pagespeed/issues/1284 to add the double-quotes in the doc.

RE expires header: I don't think you need that.  You are specifying cache-control.

-Josh

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/7a4a7401-896f-40ac-b510-5d08c000c0e1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Rafael El Mago

nieprzeczytany,
1 kwi 2016, 02:55:551.04.2016
do mod-pagespeed-discuss
According to @Jeff Kaufman

By default PageSpeed serves HTML as uncacheable, with "Cache-Control:
no-cache, max-age=0".  This means Last-Modified and Expired aren't
necessary.  It needs to do this because (1) it makes browser-specific
optimizations and (2) it generally doesn't fully optimize pages on the
first try.

If you would like to cache HTML with varnish or another cache under
your control you could try the downstream caching feature:


So if your .html headers have Expires or Pragma Headers, you can unset them:

sub vcl_backend_response {
   if (beresp.http.Content-Type ~ "text/html") {
     unset beresp.http.Cache-Control;
     set beresp.http.Cache-Control = "no-cache, max-age=0";
     unset beresp.http.expires;
     unset beresp.http.pragma;
   }
   return (deliver);
}


Odpowiedz wszystkim
Odpowiedz autorowi
Przekaż
Nowe wiadomości: 0