Uploading custom VCL
Fastly allows you create your own Varnish Configuration Language (VCL) files with specialized configurations. By uploading custom VCL files to the Fastly application, you can use custom VCL and Fastly VCL together at the same time. Keep in mind that custom VCL always takes precedence over VCL generated by the Fastly application.
Accessing the VCL interface
After Fastly support has enabled the ability to upload custom VCL to your account, you can access the VCL interface in the Fastly application. Follow these instructions to access the VCL interface:
- Log in to the Fastly application.
Click the configure tab (wrench icon).
From the Service menu, select a service and then click the blue Configure button. The main controls for your selected service appear.
Click VCL from the section list on the left. The Varnish Configuration page appears.
Uploading a VCL file
Follow these instructions to upload a custom VCL file:
In the Varnish Configuration area, click the New button. The New Varnish Configuration window appears.
In the Name field, enter the name of the VCL file. For included files, this name must match the include statement in the main VCL file. See things to know when uploading multiple files for more information.
Click Choose File and select a file to upload.IMPORTANT: Don't upload generated VCL that you've downloaded from the Fastly application. Instead, edit and then upload a copy of Fastly's VCL boilerplate to avoid errors.
Click Create. The VCL file appears in the Varnish Configurations area.
Things to know when uploading multiple files
The first VCL file you upload will be marked as Main to the right of the file name in the Varnish configurations area. Any other VCL files will be marked as Include files. They must be included in the main VCL using the syntax
include "VCL Name" where
VCL Name is the name of an included VCL object you've created.
For example, if you've created an included VCL object called "ACL" (to use an access control list for code manageability) and the file is named
acl.vcl, your main VCL configuration file would need to contain this line: