corestack_ varnish_ purge
Purge a site's Varnish cache.
When to use it
Purge a Magento 2 row's Varnish cache after content changed outside a deployment: everything, by Magento cache tag, by address or by pattern. Prefer a tag or an address to everything, so the rest of the store stays cached. Deployments purge Varnish themselves, and Magento purges its own tags when products and categories are saved, so neither needs this tool.
Ten purges an hour for each site, counted across the Corefinity Control Panel, the API and MCP together. Magento's own purges, deployments and the "Purge Varnish first" step of corestack_site_cloudflare_purge are not counted. When Cloudflare also caches the site, purge Varnish first, then Cloudflare.
The call answers a task on the purge command; follow it with corestack_command_get. Varnish confirms each purge but gives no count of the pages removed, so the result reports what was sent and that it was confirmed: {mode,.
Ask for it
Using the Corefinity MCP server, call corestack_varnish_purge with site_id 4211, mode tags, tags ["cat_p_1180","cat_c_27"]. (Purge a site's Varnish cache.) Tell me what it returned.Inputs
With urls or patterns, one of the row's storefront hosts (corestack_), without a port. Absent or null purges every host of the row. An absolute address in urls names its own host. Up to 253 characters.
all, tags, urls or patterns. Send the list that matches the mode and no other. all empties the whole cache, also files Magento does not tag (robots.txt, sitemaps, verification files).
alltagsurlspatternsWith patterns. Regular expressions (PCRE2) on the stored path and query, each starting with /; Varnish anchors them at the start, so /gravel-bikes(/|\?|$) purges that category and everything under it. /, /.* and .* purge almost everything: use mode: all instead. Up to 5 items.
The row, a Magento 2 site or one of its environments. At least 1.
With tags. Magento cache tags such as cat_p_1180 or cat_c_27: letters, digits and underscores, up to 64 characters each. Up to 50 items.
With urls. A path (/gravel-bikes) or an absolute address on one of the row's own hosts (https://example.co.uk/gravel-bikes). Each is purged exactly, its query included; Varnish ignores tracking parameters (utm_*, gclid, fbclid and the like) and the order of the others, as it does when it stores pages. Up to 30 items.
A page that one of your nginx rules rewrote is stored under the rewritten address: purge it by tag or by pattern.
Example call
{
"name": "corestack_varnish_purge",
"arguments": {
"site_id": 4211,
"mode": "tags",
"tags": [
"cat_p_1180",
"cat_c_27"
]
}
}If it is refused
| Reason | What to do |
|---|---|
varnish_off | Varnish is switched off on this row; Magento's built-in cache serves pages (flush it with corestack_function_run flush_cache). Switch Varnish on with corestack_varnish_set first. |
varnish_not_offered | The row is not a Magento 2 site. |
invalid_tags | A tag is not a Magento cache tag; fields.tags and details.offenders name each one. |
invalid_urls | An address is not a path or an address on this row, is longer than 2048 bytes, or holds spaces, quotes or control characters; details.offenders names each one. |
host_not_owned | host, or an absolute address's host, is not one of this row's storefront hosts. |
invalid_pattern | A pattern does not start with /, is longer than 256 bytes, holds spaces or quotes, or does not compile; the message carries the PCRE2 error and its offset. |
invalid_arguments | No mode, or a list that does not match the mode. |
rate_limited | The ten purges this hour are used; retry_after_seconds says when the next one is available. A purge Varnish never received does not count. |
deleted | The site is deleted (in its grace period); restore it with corestack_site_restore_deleted first. |
provisioning | The site is still being created; wait for corestack_site_provisioning_get to finish. |
managed_elsewhere | Another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done. |
tenant_mismatch | The object does not exist or the token may not see it. Check the id. |
scope_required | The token lacks a scope this call needs. Open the link in the answer to add it, then call again. |
pin_refused | The grant is limited to chosen clusters, sites or environments, and this call is outside them. Open the link in the answer to widen it. |
temporarily_unavailable | The Control Panel could not answer just now. Nothing was started; try again shortly. |
internal_error | Something went wrong on our side. Quote the trace id to support. |