BBlack has submitted this change and it was merged.

Change subject: Revert "Revert "upload VCL: do not cache objects with CL:0 and 
status 200""
......................................................................


Revert "Revert "upload VCL: do not cache objects with CL:0 and status 200""

This reverts commit 64c78ac4bf29c31c8b90306b5ab9fefbbd42f218.

Change-Id: I5d35c88ff980816c7849fd4ed3a03b92b2bf7d62
---
M templates/varnish/upload-backend.inc.vcl.erb
M templates/varnish/upload-common.inc.vcl.erb
M templates/varnish/upload-frontend.inc.vcl.erb
3 files changed, 12 insertions(+), 0 deletions(-)

Approvals:
  BBlack: Verified; Looks good to me, approved



diff --git a/templates/varnish/upload-backend.inc.vcl.erb 
b/templates/varnish/upload-backend.inc.vcl.erb
index 352b442..73482f3 100644
--- a/templates/varnish/upload-backend.inc.vcl.erb
+++ b/templates/varnish/upload-backend.inc.vcl.erb
@@ -85,6 +85,7 @@
                set beresp.http.X-MediaWiki-Original = regsub(<%= @bereq_req 
%>.url, "^(/+[^/]+/[^/]+/)thumb/([^/]+/[^/]+/[^/]+).*$", "\1\2");
        }
 
+       call upload_common_backend_response;
        return (deliver);
 }
 
diff --git a/templates/varnish/upload-common.inc.vcl.erb 
b/templates/varnish/upload-common.inc.vcl.erb
index 8f9659b..6fd33ad 100644
--- a/templates/varnish/upload-common.inc.vcl.erb
+++ b/templates/varnish/upload-common.inc.vcl.erb
@@ -36,6 +36,16 @@
        }
 }
 
+sub upload_common_backend_response {
+<% if @varnish_version4 -%>
+       // Debugging T144257. Don't cache 200 responses with CL:0.
+       if (beresp.http.Content-Length == "0" && beresp.status == 200) {
+               set beresp.ttl = 0s;
+               set beresp.uncacheable = true;
+       }
+<% end -%>
+}
+
 // Varnish strips the Range header before copying req into bereq. Save it into
 // a header and restore it in upload_common_set_range
 sub upload_common_set_xrange {
diff --git a/templates/varnish/upload-frontend.inc.vcl.erb 
b/templates/varnish/upload-frontend.inc.vcl.erb
index 83af693..7f51046 100644
--- a/templates/varnish/upload-frontend.inc.vcl.erb
+++ b/templates/varnish/upload-frontend.inc.vcl.erb
@@ -83,6 +83,7 @@
                }
        }
 
+       call upload_common_backend_response;
        return (deliver);
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5d35c88ff980816c7849fd4ed3a03b92b2bf7d62
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>

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

Reply via email to