#TIL : Check vcl file syntax before restarting


31 Jan 2018 / by KhanhIceTea

Like NginX, Varnish has a syntax checker function that helps us test the syntactic correctness.

$ varnishd -C -f [vcl file path]

Varnish will compile the file and output the result to stdout. If something goes wrong, it will throw a message like

> Message from VCC-compiler:
> Expected an action, 'if', '{' or '}'
> ('input' Line 74 Pos 6)
>     vcl_hash(req.http.Cookie);
> -----########------------------
>
> Running VCC-compiler failed, exit 1

Sound good ?