---
title: "Varnish"
url: https://docs.corefinity.com/guides/sites/software-and-services/varnish
type: guide
last_updated: 2026-11-13
feature: varnish
related:
  - https://docs.corefinity.com/api/reference/varnish/get-site-varnish.md
  - https://docs.corefinity.com/api/reference/varnish/update-site-varnish-by-post.md
  - https://docs.corefinity.com/api/reference/varnish/update-site-varnish.md
  - https://docs.corefinity.com/api/reference/varnish/get-site-varnish-command.md
  - https://docs.corefinity.com/api/reference/varnish/get-site-varnish-operation.md
  - https://docs.corefinity.com/api/reference/varnish/purge-site-varnish.md
  - https://docs.corefinity.com/mcp/tools/corestack_varnish_get.md
  - https://docs.corefinity.com/mcp/tools/corestack_varnish_set.md
  - https://docs.corefinity.com/mcp/tools/corestack_varnish_version_change.md
  - https://docs.corefinity.com/mcp/tools/corestack_varnish_purge.md
  - https://docs.corefinity.com/mcp/tools/corestack_varnish_stats.md
  - https://docs.corefinity.com/mcp/tools/corestack_varnish_policy_get.md
---
# Varnish

Switch Varnish on or off for a Magento 2 site, change its version and purge its cache.

## Before you start

- You can open the site in **Managed Websites**. Anyone who can open a site can change its Varnish.
- The site runs Magento 2 on the Medium (8 GB) package or larger.
- Varnish takes its memory from the full-page-cache share of Redis and the unused RabbitMQ share. PHP memory and the price do not change.

## Switch Varnish on or off

1. **Open Varnish configuration**

   Go to **Managed Websites**, choose the site, then **Software & services** under **Site settings**. Choose **Configure…** beside **Full-page cache**.

   _Screenshot: The Services card of a Magento 2 site. The Full-page cache row reads Varnish 7.7, with Change… and the ringed Configure… button._

2. **Use the switch**

   The switch at the bottom of **Varnish configuration** reads **On** or **Off**. Turn it on or off.

   _Screenshot: Varnish configuration for a site with Varnish serving: Purge… at the top, the cache memory, Magento using Varnish, the last purge and the On switch at the bottom._

3. **Confirm**

   To switch on, choose the **Version**, then **Switch on**. To switch off, choose **Switch off**.

   _Screenshot: The Switch Varnish off? dialog. It says Magento's built-in full-page cache takes over and that nothing is deleted, above Cancel and Switch off._

The change takes about a minute to apply, plus up to 3 minutes before it starts.

|            | What happens                                                                                                                                                                                  |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Switch on  | Magento is pointed at Varnish, which keeps whole pages in memory so repeat visits are answered without running PHP. Admin, checkout, customer pages and signed-in API calls are never cached. |
| Switch off | Magento moves to its built-in full-page cache in Redis first. Your VCL and the version you chose are kept.                                                                                    |

## Change the version

While Varnish is on, choose **Change…** beside **Full-page cache**. The dialog marks the versions your Magento release supports, and your VCL is checked against the new one before the change starts.

_Screenshot: The Change Varnish version dialog, listing the versions this site's Magento release supports with the one in use marked._

The cache starts empty after a version change.

## Purge the cache

Deployments purge everything for you, and Magento purges by tag when you save a product, category or page. To purge by hand:

1. **Open the purge dialog**

   Choose **Purge…** in **Varnish configuration**, or **Purge Varnish…** in the site header's **…** menu.

2. **Choose what to purge**

   Choose **Everything**, **By tag**, **By address** or **By pattern**, fill it in, then choose the purge button.

   _Screenshot: The Purge Varnish dialog with By tag chosen from Everything, By tag, By address and By pattern, a field for Magento cache tags and the count of purges used this hour._

| Choice         | Limit                                                                 |
| -------------- | --------------------------------------------------------------------- |
| **By tag**     | Up to 50 Magento cache tags.                                          |
| **By address** | Up to 30 addresses.                                                   |
| **By pattern** | Up to 5 patterns, matched from the start of the path, query included. |

A site has 10 purges an hour. Purges that deployments and Magento make do not count.

## Automate this

**API:** [Update a site's Varnish switch](https://docs.corefinity.com/api/reference/varnish/update-site-varnish.md), scope `write`

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/varnish \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'
```

**MCP:** [`corestack_varnish_set`](https://docs.corefinity.com/mcp/tools/corestack_varnish_set.md), scope `write`

```json
{
  "name": "corestack_varnish_set",
  "arguments": {
    "site_id": 4211,
    "enabled": true,
    "version": "8.0",
    "apply": "window"
  }
}
```

**Control Panel:** Managed Websites › your site › Site settings › Software & services ([https://manage.corefinity.com/go/varnish](https://manage.corefinity.com/go/varnish))

## Related

- [Varnish VCL](/guides/sites/software-and-services/custom-vcl): Add your own VCL to Varnish.
- [Magento 2](/guides/platforms/magento-2): See what differs for Magento 2.
- [Upgrade package](/guides/sites/size-and-capacity/upgrade-a-package): Move a site to a larger package.
