Created
November 26, 2014 17:34
-
-
Save greylabel/538a2d3a84f5d9493e35 to your computer and use it in GitHub Desktop.
Varnish config for 500-505 status codes to show the default error page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_fetch { | |
# 500-505 status should be shown the default error page | |
if (beresp.status >= 500 && beresp.status <= 505) { | |
error beresp.status beresp.response; | |
} | |
} | |
sub vcl_error { | |
# In the event of an error, show friendlier messages. | |
set obj.http.Content-Type = "text/html; charset=utf-8"; | |
synthetic {" | |
<html> | |
<head> | |
<title>Page Unavailable</title> | |
<style> | |
body { background: #303030; text-align: center; color: white; } | |
.error { color: #222; } | |
</style> | |
</head> | |
<body> | |
<div id="page"> | |
<h1 class="title">Page Unavailable</h1> | |
<p>The page you requested is temporarily unavailable.</p> | |
<p>Please try again later.</p> | |
<div class="error">(Error "} + obj.status + " " + obj.response + {")</div> | |
</div> | |
</body> | |
</html> | |
"}; | |
return (deliver); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment