CorefinityCorefinityDocs
Open the Control PanelControl Panel
Varnish · 17 of 19

Check custom VCL without saving

Checks the snippets sent in hooks against the policy and, when they pass, compiles them with the site's Varnish version, or with varnish_version. Nothing is saved.

POST/api/corestack/sites/{site}/varnish/vcl/validate

Path parameters

siteintegerRequired

The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.

Body

hooksobjectRequired

The snippets to change. One left out stays as it is; "" or null empties it.

Fields
backend_responsestring or null
deliverstring or null
recvstring or null
varnish_versionstring or null

A Varnish version to compile with instead of the site's, such as 8.0. One that is not available yet is refused version_unsupported.

6.07.78.09.1null

Returns

200 What the check found. valid is false when a diagnostic is an error.

Fields of the 200 answer
diagnosticsarray of objectsRequired
Fields of each item
codestring

The policy's rule, such as VN-POL-09; the policy explains each. Left out of a finding of the compiler, which has no rule.

columninteger or null
hookstring or null

The snippet it is about (recv, backend_response or deliver), or * for the policy's limit on the snippets together. Empty for a finding of the compiler about the VCL as a whole, whose line and column are 0.

kindstringRequired

What found it: the policy (policy for an error, advice for a warning) or the compiler (compile).

policycompileadvice
lineinteger or null
messagestringRequired
severitystringRequired
errorwarning
sourcestring

What found it, in words, such as the Varnish version the compile ran on. Left out of a finding of the policy.

testobject or any or null

The compile. Null when the policy found errors first.

validbooleanRequired

If it is refused

StatusReasonWhat to do
401noneSend a valid token as Authorization: Bearer <token>.
403company_unavailableYour company is unavailable.
403scope_requiredUse a token with the scope named in scope.
403two_factor_requiredTurn on two-factor on your account, then send again.
404feature_offThis feature is not on for your organisation yet.
409managed_elsewhereThis site is read-only here. Change it in the control panel that manages it.
409varnish_not_offeredVarnish is available for Magento 2 sites only. Nothing to change here.
409varnish_offVarnish is off on the environment. Switch it on first.
422invalidFix the field named in field; errors says why.
422version_unsupportedThat Varnish version is not offered, or not available yet. Choose another version.
429rate_limitedWait for the seconds in Retry-After.
503upstream_unavailableA service the action depends on did not answer. Try again later.

Reasons are listed by name in Errors and refusals.

The same task elsewhere

curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/varnish/vcl/validate \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "hooks": {
      "recv": "if (req.url ~ \"^/stock-checker/\") {\n    return (pass);\n}\n"
    }
  }'
{
  "diagnostics": [
    {
      "code": "VN-POL-09",
      "column": 5,
      "hook": "recv",
      "kind": "policy",
      "line": 1,
      "message": "vcl_recv runs after the front's access control (HTTP authentication, the allow-list, maintenance), which judged the original URL and host: a snippet may not change req.url, the Host header or another routing header (X-Original-URL, X-Rewrite-URL, X-HTTP-Method-Override, X-HTTP-Method, X-Method-Override). Redirect with return (synth(301, \"...\")) instead.",
      "severity": "error"
    }
  ],
  "test": null,
  "valid": false
}
Try it
Held in this tab's memory only. Never stored or sent to us.

This sends a real POST request and changes your account.

Use a token with only the read scope. How to make one

Was this helpful?
Open in ClaudeOpen in ChatGPT