diff options
Diffstat (limited to 'extras/misc')
-rw-r--r-- | extras/misc/varnish.vcl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/extras/misc/varnish.vcl b/extras/misc/varnish.vcl index 492f001..b10a640 100644 --- a/extras/misc/varnish.vcl +++ b/extras/misc/varnish.vcl @@ -7,6 +7,11 @@ backend default { .port = "80"; } +backend graphite { + .host = "gondul-graphite"; + .port = "80"; +} + sub vcl_recv { if (req.url ~ "^/where" || req.url ~ "^/location") { set req.url = "/api/public/location"; @@ -27,6 +32,10 @@ sub vcl_recv { return (pass); } + if (req.url ~ "/render") { + set req.backend_hint = graphite; + } + # Brukes ikke. Cookies er for nubs. unset req.http.Cookie; @@ -48,6 +57,15 @@ sub vcl_backend_response { if (beresp.http.x-ban) { ban("obj.http.x-url ~ " + beresp.http.x-ban); } + if (bereq.url ~ "/render") { + # Graphite claims "no-cache", which is dumb. + # Let's blindly cache for 5+10s. Which is 10000 times better. + set beresp.http.Cache-Control = "max-age=5s"; + unset beresp.http.Pragma; + set beresp.uncacheable = false; + set beresp.grace = 10s; + set beresp.ttl = 5s; + } if (beresp.status != 200) { set beresp.uncacheable = false; set beresp.ttl = 5s; |