Show proxy name on varnish errors

This commit is contained in:
Patrick Uiterwijk
2015-06-17 07:06:17 +00:00
parent 04ed209dc1
commit 46d2abf3f7
2 changed files with 23 additions and 2 deletions

View File

@@ -26,8 +26,8 @@
- varnish
- name: install /etc/varnish/default.vcl
copy: src={{ item }} dest=/etc/varnish/default.vcl
owner=root group=root
template: src=proxy.vcl dest=/etc/varnish/default.vcl
owner=root group=root
with_items:
- proxy.vcl
notify:

View File

@@ -134,6 +134,27 @@ acl purge {
"192.168.1.58"; //lockbox01.vpn
}
sub vcl_synth {
set resp.http.Content-Type = "text/html; charset=utf-8";
set resp.http.Retry-After = "5";
synthetic( {"<!DOCTYPE html>
<html>
<head>
<title>"} + resp.status + " " + resp.reason + {"</title>
</head>
<body>
<h1>Error "} + resp.status + " " + resp.reason + {"</h1>
<p>"} + resp.reason + {"</p>
<h3>Guru Meditation:</h3>
<p>XID: "} + req.xid + {"</p>
<hr>
<p>Varnish cache server on {{ ansible_fqdn }}</p>
</body>
</html>
"} );
return (deliver);
}
sub vcl_recv {
if (req.method == "PURGE") {
if (!client.ip ~ purge) {