Mark Bergsma has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75586


Change subject: Use hit_for_pass for TTL <= 0s objects
......................................................................

Use hit_for_pass for TTL <= 0s objects

Change-Id: I836916fe79dd3cb240ae3703c3351fcd3a7c0a01
---
M templates/varnish/text-backend.inc.vcl.erb
M templates/varnish/text-frontend.inc.vcl.erb
2 files changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/86/75586/1

diff --git a/templates/varnish/text-backend.inc.vcl.erb 
b/templates/varnish/text-backend.inc.vcl.erb
index 196a2ee..5ed6291 100644
--- a/templates/varnish/text-backend.inc.vcl.erb
+++ b/templates/varnish/text-backend.inc.vcl.erb
@@ -32,7 +32,9 @@
 
 sub vcl_fetch {
        /* FIXME: Fix up missing Vary headers on Apache redirects */
-       if ((beresp.status == 301 || beresp.status == 302) && 
beresp.http.Location ~ "^http" && beresp.http.Vary !~ "X-Forwarded-Proto") {
+       if ((beresp.status == 301 || beresp.status == 302)
+               && beresp.http.Location ~ "^http"
+               && beresp.http.Vary !~ "X-Forwarded-Proto") {
                if (beresp.http.Vary) {
                        set beresp.http.Vary = beresp.http.Vary + 
",X-Forwarded-Proto";
                } else {
@@ -40,6 +42,10 @@
                }
        }
 
+       if (beresp.ttl <= 0s) {
+               set beresp.ttl = 120s;
+               return (hit_for_pass);
+       }
        return (deliver);
 }
 
diff --git a/templates/varnish/text-frontend.inc.vcl.erb 
b/templates/varnish/text-frontend.inc.vcl.erb
index 3d8d4d4..797f7c5 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -48,6 +48,10 @@
 }
 
 sub vcl_fetch {
+       if (beresp.ttl <= 0s) {
+               set beresp.ttl = 120s;
+               return (hit_for_pass);
+       }
        return (deliver);
 }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/75586
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I836916fe79dd3cb240ae3703c3351fcd3a7c0a01
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mark Bergsma <m...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to