About VCL Snippets
Last updated August 09, 2018
VCL Snippets are short blocks of VCL logic that can be included directly in your service configurations. They're ideal for adding small sections of code when you don't need more complex, specialized configurations that sometimes require custom VCL. Fastly supports two types of VCL Snippets:
- Regular VCL Snippets get created as you create versions of your Fastly configurations. They belong to a specific service and any modifications you make to the snippet are locked and deployed when you deploy a new version of that service. You can treat regular snippets like any other Fastly objects because we continue to clone them and deploy them with a service until you specifically delete them. You can create regular snippets using either the web interface or via the API. Dynamic VCL Snippets can be modified and deployed any time they're changed. Because they are versionless objects (much like Edge Dictionaries or ACLs at the edge), dynamic snippets can be modified independently from service changes. This means you can modify snippet code rapidly without deploying a service version that may not be ready for production. You can only create dynamic snippets via the API.
Limitations of VCL Snippets
- Snippets are limited to 1MB in size by default. If you need to store snippets larger than the limit, contact email@example.com.
- Snippets do not currently support conditions, though
ifstatements can be used within snippet code instead.
- Snippets cannot currently be shared between services.