Simplified VCL for Varnish

Varnish

If you're using Varnish, the following VCL file has helped some customers who are setting up local environments that closely resemble Acquia Cloud systems.


backend default {
   .host = "127.0.0.1";
   .port = "8080";
   .connect_timeout = 2s;
}
 
sub vcl_recv {
if (req.http.X-Forwarded-For) {
   set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
} else {
   set req.http.X-Forwarded-For = client.ip;
}
if (req.request != "GET" && req.request != "HEAD") {
   return(pass);
}
if(req.url ~ "^/cron.php") {
   return(pass);
}
if(req.url ~ "^/xmlrpc.php") {
   return(pass);
}
if (req.http.Authorization) {
   return(pass);
}
if(req.http.cookie ~ "(^|;\s*)(SESS=)") {
   return(pass);
}
return(lookup);
}

This is a basic example. If you have other needs or tests you want to perform, we suggest that you visit the VCL examples page, which includes several real-world examples of VCL that you can use for reference.

Contact supportStill need assistance? Contact Acquia Support