Fastly Help Guides

Return to VCL Extensions

Guide to VCL

Fastly's is based on Varnish 2.1 and our Varnish syntax is specifically compatible with Varnish 2.1.5. We run a custom version with added functionality.

Online Varnish Software and VCL Documentation

The official Varnish documentation is a good place to start when looking for online information:

https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html

In addition, Varnish Software, who provides commercial support for Varnish, has written a free book:

https://www.varnish-software.com/static/book/index.html

Specifically, the VCL references are located here:

https://www.varnish-software.com/static/book/VCL_Basics.html

https://www.varnish-software.com/static/book/VCL_functions.html

Books on Varnish and VCL

Roberto Moutinho has written a book on using Varnish that may help:

http://www.amazon.com/Instant-Varnish-Cache-Roberto-Moutinho/dp/178216040X/

Fastly's VCL Extensions

In addition, Fastly has included a number of extensions to VCL that won't be covered by any other documentation. Specifically:

Extensions

Description

cryptographic and hashing functions

Supports Hash-based Message Authentication Code (HMAC), a message authentication code that uses a cryptographic key in conjunction with a hash function.

date- and time-related features

Supports the default VCL “now” variable that provides the current time as an RFC 850 formatted date (e.g., Tuesday, 29-Apr-14 08:41:55), as well as several new functions that allow you to have more flexibility when dealing with dates and times.

GeoIP features

Provides the ability to search a database from MaxMind.com for a given host or IP address, and return information about the country, city or Internet Service Provider (ISP) for that IP address.

randomness features

Supports the insertion of random strings, content cookies, and decisions into requests.

size-related variables

Supports reporting variables that offer insight into what happened in a request.

miscellaneous features and variables

Provides miscellaneous VCL extensions not easily grouped into other categories.

REMEMBER: The ability to upload custom VCL code is disabled by default when you sign up. To enable this ability for your account, contact support@fastly.com and request it.