director xxx_htmlbackend round-robin { { .backend = { .host = "192.168.1.xxx"; .port = "xx"; .connect_timeout = 20s; .first_byte_timeout = 60s; .between_bytes_timeout = 30s; } } { .backend = { .host = "192.168.1.xxx"; .port = "xx"; .connect_timeout = 20s; .first_byte_timeout = 60s; .between_bytes_timeout = 30s; } } { .backend = { .host = "192.168.1.xxx"; .port = "xx"; .connect_timeout = 20s; .first_byte_timeout = 60s; .between_bytes_timeout = 30s; } } { .backend = { .host = "192.168.1.xxx"; .port = "xx"; .connect_timeout = 20s; .first_byte_timeout = 60s; .between_bytes_timeout = 30s; } } { .backend = { .host = "192.168.1.xxx"; .port = "xx"; .connect_timeout = 20s; .first_byte_timeout = 60s; .between_bytes_timeout = 30s; } } } acl purge { "localhost"; "xx.xx.xx.xx"/24; "xx.xx.xx.xx"/29; } sub vcl_recv { set req.backend = photos_htmlbackend; if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { /* Non-RFC2616 or CONNECT which is weird. Shoot this client, but first go in pipeline to the webserver. Maybe he knows what to do with this request. */ return (pipe); } if (req.http.X-Requested-With == "XMLHttpRequest") { return (pass); } 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; } } return(lookup); } sub vcl_pipe { return (pipe); } sub vcl_pass { return (pass); } sub vcl_hash { /* Omdat images statisch zijn hoeven we hier niet te kijken naar cookies of andere elementen waarop hij zijn cache moet valideren. pretty straight forward dus. */ set req.hash += req.url; return (hash); } sub vcl_hit { if (!obj.cacheable) { return(pass); } # Ignore requests via proxy caches, IE users and badly behaved crawlers # like msnbot that send no-cache with every request. if (req.http.Cache-Control ~ "no-cache" && ( !(req.http.Via || req.http.User-Agent ~ "bot|MSIE") || (client.ip ~ purge))) { set obj.ttl = 0s; return (restart); } return (deliver); } sub vcl_miss { return (fetch); } sub vcl_fetch { if (!beresp.cacheable) { return (pass); } #set beresp.grace = 30m; return (deliver); } sub vcl_deliver { remove resp.http.Via; remove resp.http.X-Varnish; if (obj.hits > 0) { set resp.http.X-Cache = "HIT"; } else { set resp.http.X-Cache = "MISS"; } set resp.http.Server = "xxx"; return (deliver); } sub vcl_error { set obj.http.Content-Type = "text/html; charset=utf-8"; synthetic {" "} obj.status " " obj.response {"

Error "} obj.status " " obj.response {"

"} obj.response {"

Guru Meditation:

XID: "} req.xid {"

Freeones
"}; return (deliver); }