Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350966 )

Change subject: varnish: Make errorpage.html balanced and use placeholder
......................................................................

varnish: Make errorpage.html balanced and use placeholder

* Fix unclosed tags in varnish/files/errorpage.html to be closed
  properly.
* Change errorpage.inc.vcl to use regsub() instead of string
  concatenation.

This is in preparation of making errorpages more centralised and derived
from a common template. It would help if callers don't have to hardcode the
fact that the error is at the end of the HTML and in a specific subtree.

Bug: T113114
Change-Id: Id77d23a442ab9ba39bd683a93d43bb1a9de54d6b
---
M modules/varnish/files/errorpage.html
M modules/varnish/templates/errorpage.inc.vcl.erb
2 files changed, 9 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/66/350966/1

diff --git a/modules/varnish/files/errorpage.html 
b/modules/varnish/files/errorpage.html
index 395fdef..7471b95 100644
--- a/modules/varnish/files/errorpage.html
+++ b/modules/varnish/files/errorpage.html
@@ -23,4 +23,6 @@
 </div>
 <div class="footer">
 <p>If you report this error to the Wikimedia System Administrators, please 
include the details below.</p>
-<p class="text-muted"><code>
+<p class="text-muted"><code>%error%</code></p>
+</div>
+</html>
diff --git a/modules/varnish/templates/errorpage.inc.vcl.erb 
b/modules/varnish/templates/errorpage.inc.vcl.erb
index 3b52c6c..8948d2c 100644
--- a/modules/varnish/templates/errorpage.inc.vcl.erb
+++ b/modules/varnish/templates/errorpage.inc.vcl.erb
@@ -1,27 +1,27 @@
 sub backend_error_errorpage {
        set beresp.http.Content-Type = "text/html; charset=utf-8";
 
-       synthetic(std.fileread("/etc/varnish/errorpage.html") +
+       synthetic(regsub(std.fileread("/etc/varnish/errorpage.html"), '%error%',
                "Request from " + bereq.http.X-Client-IP +
                " via " + server.hostname + " " + server.identity +
                ", Varnish XID " + bereq.xid + "<br>" +
                regsub(beresp.http.X-Cache, ".+", "Upstream caches: \0<br>") +
                "Error: " + beresp.status + ", " +
                beresp.reason +
-               " at " + now + "</code></p></div></html>"
-       );
+               " at " + now
+       ));
 }
 
 sub synth_errorpage {
        set resp.http.Content-Type = "text/html; charset=utf-8";
 
-       synthetic(std.fileread("/etc/varnish/errorpage.html") +
+       synthetic(regsub(std.fileread("/etc/varnish/errorpage.html"), '%error%',
                "Request from " + req.http.X-Client-IP +
                " via " + server.hostname + " " + server.identity +
                ", Varnish XID " + req.xid + "<br>" +
                regsub(resp.http.X-Cache, ".+", "Upstream caches: \0<br>") +
                "Error: " + resp.status + ", " +
                resp.reason +
-               " at " + now + "</code></p></div></html>"
-       );
+               " at " + now
+       ));
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id77d23a442ab9ba39bd683a93d43bb1a9de54d6b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to