Created
November 18, 2010 16:42
-
-
Save briceburg/705251 to your computer and use it in GitHub Desktop.
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
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
.connect_timeout = 30s; | |
.first_byte_timeout = 30s; | |
} | |
sub vcl_recv { | |
return(pipe); | |
set req.grace = 30m; | |
if (req.http.Accept-Encoding) { | |
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { | |
# No point in compressing these | |
remove req.http.Accept-Encoding; | |
} elsif (req.http.Accept-Encoding ~ "gzip") { | |
set req.http.Accept-Encoding = "gzip"; | |
} elsif (req.http.Accept-Encoding ~ "deflate") { | |
set req.http.Accept-Encoding = "deflate"; | |
} else { | |
# unkown algorithm | |
remove req.http.Accept-Encoding; | |
} | |
} | |
if (req.url ~ "\.(png|css|js|jpg|jpeg|gif|ico|swf)$") { | |
unset req.http.cookie; | |
return (lookup); | |
} | |
} | |
sub vcl_fetch { | |
if (beresp.status == 500) { | |
set beresp.saintmode = 30s; | |
restart; | |
} | |
set beresp.grace = 30m; | |
if (req.url ~ "\.(png|css|js|jpg|jpeg|gif|ico|swf)$") { | |
unset beresp.http.set-cookie; | |
#set beresp.ttl = 5m; | |
} | |
} | |
sub vcl_deliver { | |
if (obj.hits > 0) { | |
set resp.http.X-Lookup = "HIT"; | |
} else { | |
set resp.http.X-Lookup = "MISS"; | |
} | |
} | |
sub vcl_error { | |
set obj.http.Content-Type = "text/html; charset=utf-8"; | |
synthetic {" | |
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Website Error</title> | |
</head> | |
<body> | |
<h1>Error "} obj.status " " obj.response {"</h1> | |
<p>"} obj.response {"</p> | |
</body> | |
</html> | |
"}; | |
return (deliver); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment