Created
May 14, 2014 18:16
-
-
Save onethumb/e64a405cc579909cace1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import directors; | |
probe health { | |
.url = "/ping/"; | |
.expected_response = 200; | |
.timeout = 1s; | |
.interval = 1s; | |
} | |
backend instance1 { | |
.host = "10.100.18.112"; | |
.port = "80"; | |
.probe = health; | |
} | |
backend instance2 { | |
.host = "10.100.19.233"; | |
.port = "80"; | |
.probe = health; | |
} | |
sub vcl_init { | |
new PhotoServe = directors.round_robin(); | |
PhotoServe.add_backend(instance1); | |
PhotoServe.add_backend(instance2); | |
} | |
sub vcl_recv { | |
if(req.url ~ "\.(jpg|gif|png|mp4)$") { | |
set req.backend_hint = PhotoServe.backend(); | |
return(hash); | |
} | |
if(req.url ~ ".smil/") { | |
set req.backend_hint = PhotoServe.backend(); | |
return(hash); | |
} | |
} | |
sub vcl_backend_response { | |
if(beresp.http.Content-Type ~ "video") { | |
set beresp.do_stream = true; | |
set beresp.do_gzip = false; | |
//set resp.http.Content-Length = beresp.http.Content-Length; | |
} | |
if(beresp.http.Edge-Control == "no-store") { | |
set beresp.uncacheable = true; | |
set beresp.ttl = 60s; | |
set beresp.http.Smug-Cacheable = "No"; | |
return(deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment