Skip to content

VIP14: *.body access

Poul-Henning Kamp edited this page Feb 27, 2017 · 2 revisions

Synopsis

Plan for VCL access/manipulation of *.body and VMOD filter insertion

Why?

So for instance synthetic objects can be gzip'ed or ESI'ed, but without overworking the workspaces.

How?

The list of filters to be applied is turned into a list of filter names, something like:

req.filters = "gunzip esi gzip"

VCL can edit this list, for instance with regsub() to insert VMOD filters

A special class of VCL functions can stuff things into the filter pipelines:

sub vcl_foobar {
    body += "<HTML>"
    body += "<H1>" + req.http.foobar + "</H1>"
    ...
}

The vcl_error{} and vcl_synthetic{} functions set up the HTTP headers, configure the filter list and designate the function to fill out the body:

sub vcl_synthetic {
    ...
    return (deliver(vcl_foobar));
}
Clone this wiki locally