Created
April 17, 2019 17:53
-
-
Save rezan/d22295a80a95d33d8ea1a3c94242cb74 to your computer and use it in GitHub Desktop.
Backend prefetch
This file contains hidden or 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
# 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