varnishd -C: Compile-Test a VCL File
varnishd -C -f <file.vcl> compiles the VCL to C and exits, so you can validate a VCL change without running Varnish.
Varnish config is VCL, which is compiled at load time. varnishd -C runs that compile step in CI, catching VCL errors before a deploy tries to load them.
What it does
varnishd -C loads the VCL file given with -f, runs the VCL compiler (translating VCL to C and compiling it), prints the generated C to stdout, and exits without starting the cache or binding a port. A compile error prints a diagnostic and returns a non-zero exit code.
Common usage
varnishd -C -f /etc/varnish/default.vcl
# discard stdout, keep only errors, for a clean CI gate
varnishd -C -f default.vcl >/dev/null
# validate the VCL syntax version too
varnishd -C -f default.vcl 2>&1 | headOptions
| Flag | What it does |
|---|---|
| -C | Compile the VCL and print the C, then exit |
| -f <file> | VCL file to compile |
| -p <param=value> | Set a run-time parameter (rarely needed for -C) |
| -V | Print version and exit |
In CI
Run varnishd -C -f your.vcl in the Varnish image that matches production, since the VCL syntax version and available vmods differ across Varnish releases. Redirect stdout to /dev/null so only the compiler diagnostics appear in the log. Non-zero exit means a broken VCL, which fails the gate.
Common errors in CI
Message from VCC-compiler: Expected an action, 'if', '{' or '}' names a VCL syntax error at a line and column. "VCL version not supported" means the vcl 4.1; header does not match the daemon version. "Symbol not found" often means a vmod (import) that is not installed in the image. Fix by matching the image version and installing the vmod.