vcl 4.1; backend default { .host = "ghost"; .port = "2368"; } sub vcl_recv { # Normalize the Host header if (req.http.host ~ "^www\.") { return (synth(750, "")); } # Don't cache the admin panel or API if (req.url ~ "^/ghost/" || req.url ~ "^/ghost-api/") { return (pass); } } sub vcl_synth { if (resp.status == 750) { set resp.status = 301; set resp.http.Location = "https://speedyweedyops.org" + req.url; return(deliver); } } sub vcl_backend_response { # Cache everything for 1 hour by default set beresp.ttl = 1h; # Don't cache responses with these headers if (beresp.http.Set-Cookie || beresp.http.Vary == "*") { set beresp.uncacheable = true; return (deliver); } # Don't cache responses for authenticated users if (beresp.http.Cache-Control ~ "private") { set beresp.uncacheable = true; return (deliver); } } sub vcl_deliver { # Add a custom header to indicate cache hit/miss if (obj.hits > 0) { set resp.http.X-Cache = "HIT"; } else { set resp.http.X-Cache = "MISS"; } }