Guide to VCL
Last updated 2021-04-20
Fastly’s Edge Cloud services use the Fastly Varnish Configuration Language (VCL), a scripting language used to configure and add logic to Varnish caches. Fastly VCL allows you to generate and compile changes to your Fastly services. These changes can be distributed to all Fastly caches worldwide and then loaded and activated without requiring maintenance windows or service downtime. Fastly VCL is generated automatically per your service configurations specified via the web interface.
VCL and what you can do with it
We allow you to create your own VCL files with specialized configurations. Your custom VCL files can be uploaded into Fastly caches and activated.
You can also mix and match custom VCL and Fastly VCL, using them together at the same time. You will never lose the options on the Fastly web interface when you use custom VCL, but keep in mind that custom VCL always takes precedence over any VCL generated by the web interface. Be mindful of where your custom VCL sits in the default VCL.
Personal data should not be incorporated into VCL. Our Compliance and Law FAQ describes in detail how Fastly handles personal data privacy.
Embedding inline C code in VCL
Currently, we don't provide embedded C access to our users. Fastly is a shared infrastructure. By allowing the use of inline C code, we could potentially give a single user the power to read, write to, or write from everything. As a result, our varnish process (i.e., files on disk, memory of the varnish user's processes) would become unprotected because inline C code opens the potential for users to do things like crash servers, steal data, or run a botnet.
We appreciate feedback from our customers. If you are interested in a feature that requires C code, contact firstname.lastname@example.org. Our engineering team looks forward to these kinds of challenges.
Where to learn more about VCL and Varnish
Fastly's Developer Hub provides a reference of Fastly VCL for programming custom edge logic on VCL services. You can also discover more about learning to build on the Fastly platform using VCL and the current best practices involved.
The official Varnish documentation is a good place to start when looking for online information. In addition, Varnish Software, who provides commercial support for Varnish, has written a free online book.
Roberto Moutinho's book Instant Varnish Cache also provides information.