Logo Knowledge
  • Product Documentation
  • Insight
  • Developer Center
  • Training
  • Submit a Request
  • Product Documentation
  • Insight
  • Developer Center
  • Training
  • Submit a Request
  1. Acquia Support Knowledge Base
  2. How-To
  3. Tips & Tricks

Simplified VCL for Varnish

    See more
    • Updated
    • May 08, 2019 17:52

    Issue

    I would like to set up a local environment with Varnish to closely resemble what I have hosted. 

    Resolution

    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.

    Acquia Products

    • Acquia Cloud

    Topics

    • varnish

    External Links

    • VCL Examples
    Avatar
    Acquia Support Systems
    • May 08, 2019 17:52
    • Updated
    • Facebook
    • Twitter
    • LinkedIn

    Was this article helpful?
    1 out of 3 found this helpful

    Return to top

    Related articles

    • Varnish: Bypassing the cache
    • Proxies and Acquia Cloud
    • Acquia's default Varnish VCL strips Google Analytics and Facebook Ads query string parameters
    • Set max-age headers for specific pages, files, or paths
    • How to make Varnish ignore a URL's query string for front-end application use

    Support

    Acquia Support Knowledge Base
    • Submit a Request
    • Contact Support
    • Acquia Support Guide
    • Product Documentation
    • System Status

    About Acquia

    • About Us
    • Leadership
    • Board of directors
    • Newsroom
    • Careers
    • Customers
    • Contact Us
    53 State Street, 10th Floor
    Boston, MA 02109
    United States
    Phone: 888-922-7842
    Map: Google Maps
    View other locations
    • Feeds
    • Legal
    • Security Issue?

    Copyright © 2018 Acquia Inc. All Rights Reserved. Drupal is a registered trademark of Dries Buytaert.