Skip to content

Instantly share code, notes, and snippets.

@rezan
Created July 3, 2018 19:48
Show Gist options
  • Select an option

  • Save rezan/fa81dfb954c0397b0ce35c34dcadef64 to your computer and use it in GitHub Desktop.

Select an option

Save rezan/fa81dfb954c0397b0ce35c34dcadef64 to your computer and use it in GitHub Desktop.
Aggregate response headers and body into a single response block
vcl 4.0;
# If you set req.http.X-aggregate = "true", Varnish will aggregate
# the headers and response body into a single response block
# Point this back to Varnish
#backend loop {
# .host = "127.0.0.1";
# .port = "80";
#}
sub vcl_recv {
if (req.http.X-aggregating == "true") {
return (pass);
}
}
sub vcl_backend_fetch {
if (bereq.http.X-aggregate == "true" && !bereq.http.X-aggregating) {
set bereq.http.X-aggregating = "true";
set bereq.backend = loop;
}
}
sub vcl_backend_response {
if (bereq.http.X-aggregating == "true") {
set beresp.do_stream = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment