Skip to content

Instantly share code, notes, and snippets.

@rezan
Created April 17, 2019 17:53
Show Gist options
  • Save rezan/d22295a80a95d33d8ea1a3c94242cb74 to your computer and use it in GitHub Desktop.
Save rezan/d22295a80a95d33d8ea1a3c94242cb74 to your computer and use it in GitHub Desktop.
Backend prefetch
# Backend prefetch
vcl 4.1;
import http;
sub vcl_recv {
// Generate the prefetch URL
set req.http.X-prefetch = http.prefetch_next_url(prefix = "/.*/dash/[0-9]+-[0-9]+/");
}
sub vcl_backend_fetch {
if (bereq.http.X-prefetch != "") {
// Execute prefetch of the next segment
http.init(0);
http.req_copy_headers(0);
http.req_set_method(0, "HEAD");
http.req_set_url(0, bereq.http.X-prefetch);
http.req_send_and_finish(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment