Skip to content

Instantly share code, notes, and snippets.

@timbirk
Created June 27, 2018 14:50
Show Gist options
  • Save timbirk/1fe37567dd331bb887b4c28754b0f222 to your computer and use it in GitHub Desktop.
Save timbirk/1fe37567dd331bb887b4c28754b0f222 to your computer and use it in GitHub Desktop.
Simple VCL Puppet template with caching
# This file is managed by Puppet. Manual changes will be destroyed.
# A naively simple config to cache items for <%= @cache_ttl %> and serve stale objects
# for up to <%= @grace_ttl %> on backend outage (data reload)
vcl 4.0;
# Default backend definition.
backend default {
.host = "127.0.0.1";
.port = "<%= @proxy_port %>";
.connect_timeout = 2s;
.first_byte_timeout = 30s;
.probe = {
.url = "/";
.timeout = 15s;
.interval = 30s;
.window = 5;
.threshold = 3;
}
}
sub vcl_backend_response {
set beresp.grace = <%= @grace_ttl %>;
set beresp.ttl = <%= @cache_ttl %>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment