Skip to content

Instantly share code, notes, and snippets.

@selcukusta
Last active April 26, 2017 20:20
Show Gist options
  • Select an option

  • Save selcukusta/6010f6420f22ab99a00ee4393ac8a34d to your computer and use it in GitHub Desktop.

Select an option

Save selcukusta/6010f6420f22ab99a00ee4393ac8a34d to your computer and use it in GitHub Desktop.
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
.host = "tornado-app";
.port = "1905";
}
sub vcl_backend_response {
unset beresp.http.cookie;
set beresp.ttl = 5s;
return(deliver);
}
sub vcl_deliver {
set resp.http.Hits = obj.hits;
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
return(deliver);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment