Skip to content

Instantly share code, notes, and snippets.

@pborreli
Last active September 8, 2016 16:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pborreli/ed11ade95a30ea774c37d3d4581ec1ed to your computer and use it in GitHub Desktop.
Save pborreli/ed11ade95a30ea774c37d3d4581ec1ed to your computer and use it in GitHub Desktop.
If you are using Varnish and ESI with a Symfony application and need to profile not only the master request but with ESI requests included, don't announce your ESI support, Symfony will fallback to internal sub requests.
sub vcl_recv {
if (req.http.X-Blackfire-Query && client.ip ~ profile) {
//set req.backend_hint = backend1; // if you want to disable loadbalancer to profile (aka only 1 backend needs blackfire extension
return (pass);
} else {
// Add a Surrogate-Capability header to announce ESI support.
set req.http.Surrogate-Capability = "abc=ESI/1.0";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment