Already a member? Log in

Sign up with your...

or

Sign Up with your email address

Add Tags

Duplicate Tags

Rename Tags

Share It With Others!

Save Link

Sign in

Sign Up with your email address

Sign up

By clicking the button, you agree to the Terms & Conditions.

Forgot Password?

Please enter your username below and press the send button.
A password reset link will be sent to you.

If you are unable to access the email address originally associated with your Delicious account, we recommend creating a new account.

ADVERTISEMENT
ADVERTISEMENT

URL: https://www.varnish-cache.org/trac/wiki/VCLExamples

VCLExamples – Varnish

Attention: As of 2.1.0, obj.* is called beresp.* in vcl_fetch, and obj.* is now read-only.

VCL Examples

VCL Real World Examples

Below are full VCL's used already in live production systems.

These should only be used as a reference to help build your own VCL!

Submitted by alexc - 25-09-2009 - varnish 2.0.4 stable

Submitted by Niall Douglas - 21st Jan 2011 - NEEDS varnish v2.0.5 or later. This VCL has the following features:

Designed to primarily cache Zope and Plone content.

Gives an example of how to "mount" parts of other websites onto your own e.g. here I mount Google Finance and the RePeC economics database. VERY useful for AJAX programming!

Uses cunningly designed statically compiled regular expressions to perform VirtualHostMonster? style auto-generation of VirtualHostBase? paths out of the HTTP headers (includes HTTPS support!). This saves you having to specify them manually for each and every site you host.

Enables varnish to serve stale content up to 24h old if Zope has gone down (very useful for performing upgrades), but keeps grace at 20s if the Zope backend is healthy. Note that this bit particularly requires the If-None-Match ETag support in varnish v2.0.5 and later.

Patches SVGZ files to be returned as a more compatible SVG + gzip content encoded.

Harmonises Content-Encoding to avoid caching too many copies.

Submitted by Niall Douglas - 21st Jan 2011 - varnish v2.0.5 or later. This VCL configures a dumb content caching server which provides a local copy of another server's content. VERY useful for geo-targeted content, or for setting up an "everything has gone tits up so fall back to something" solution.

Security.vcl - a Web Application Firewall implemented in VCL

Varnish 3.0 templates - Wordpress, Drupal, Joomla and Fork CMS VCL templates

VCL Example Templates

Share It With Others!

ADVERTISEMENT
ADVERTISEMENT