readme changelog updated, stable tag updated 1.4.3
[varnish-caching-wordpress-plugin.git] / varnish-conf / v4 / lib / bigfiles_pipe.vcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# bigfiles_pipe.vcl -- Pipe for Large Files

# You must have "import std;" in your main vcl:
# import std;

# NOTE: Using restart and pipe is a workaround for a bug in varnish prior to
# 3.0.3.  In 3.0.3+, hit_for_pass in vcl_fetch is all that is necessary.

sub vcl_recv {
    if (req.http.X-Pipe-Big-File && req.restarts > 0) {
        unset req.http.X-Pipe-Big-File;
        return (pipe);
    }
}

sub vcl_fetch {
    # Bypass cache for files > 10 MB
    if (std.integer(beresp.http.Content-Length, 0) > 10485760) {
        set req.http.X-Pipe-Big-File = "Yes";
        return (restart);
    }
}

comments