diff --git a/.symfony/config.vcl b/.symfony/config.vcl index 44e8b3c..cd0a9b3 100644 --- a/.symfony/config.vcl +++ b/.symfony/config.vcl @@ -1,3 +1,11 @@ +acl profile { + # Authorize the local IP address (replace with the IP found above) + "a.b.c.d"; + # Authorize Blackfire servers + "46.51.168.2"; + "54.75.240.245"; +} + sub vcl_recv { set req.backend_hint = application.backend(); set req.http.Surrogate-Capability = "abc=ESI/1.0"; @@ -8,6 +16,16 @@ sub vcl_recv { } return (purge); } + + # Don't profile ESI requests + if (req.esi_level > 0) { + unset req.http.X-Blackfire-Query; + } + + # Bypass Varnish when the profile request comes from a known IP + if (req.http.X-Blackfire-Query && client.ip ~ profile) { + return (pass); + } } sub vcl_backend_response {