Mark Bergsma has uploaded a new change for review.

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


Change subject: Derive the corresponding original URL and store it with the 
thumb
......................................................................

Derive the corresponding original URL and store it with the thumb

Change-Id: I5c93e62aea4c1331e257bd0a9844ac8ed8f8a1ad
---
M templates/varnish/upload-backend.inc.vcl.erb
M templates/varnish/upload-frontend.inc.vcl.erb
2 files changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/07/101207/1

diff --git a/templates/varnish/upload-backend.inc.vcl.erb 
b/templates/varnish/upload-backend.inc.vcl.erb
index 3ffd411..56d30da 100644
--- a/templates/varnish/upload-backend.inc.vcl.erb
+++ b/templates/varnish/upload-backend.inc.vcl.erb
@@ -126,6 +126,11 @@
                set beresp.http.X-Content-Range = beresp.http.Content-Range;
        }
 
+       # Derive the corresponding original URL and store it with the object
+       if (!beresp.http.X-MediaWiki-Original && req.url ~ 
"^/+[^/]+/[^/]+/thumb/[^/]+/[^/]+/[^/]+/[0-9]+px-") {
+               set beresp.http.X-MediaWiki-Original = regsub(req.url, 
"^(/+[^/]+/[^/]+/)thumb/([^/]+/[^/]+/[^/]+).*$", "\1\2");
+       }
+
        return (deliver);
 }
 
diff --git a/templates/varnish/upload-frontend.inc.vcl.erb 
b/templates/varnish/upload-frontend.inc.vcl.erb
index 5ac95ab..574f033 100644
--- a/templates/varnish/upload-frontend.inc.vcl.erb
+++ b/templates/varnish/upload-frontend.inc.vcl.erb
@@ -76,6 +76,8 @@
 }
 
 sub vcl_deliver {
+       unset resp.http.X-MediaWiki-Original;
+
        if (resp.http.X-Content-Range) {
                set resp.http.Content-Range = resp.http.X-Content-Range;
                remove resp.http.X-Content-Range;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c93e62aea4c1331e257bd0a9844ac8ed8f8a1ad
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