PHPackages                             trive/varnish - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. trive/varnish

ActiveMagento2-module

trive/varnish
=============

Magento 2 Varnish Fixes Module

1.0.0(8y ago)3941.3k↓50%11[4 issues](https://github.com/trive-digital/magento2-varnish-fixes/issues)proprietaryPHP

Since Dec 21Pushed 7y ago4 watchersCompare

[ Source](https://github.com/trive-digital/magento2-varnish-fixes)[ Packagist](https://packagist.org/packages/trive/varnish)[ RSS](/packages/trive-varnish/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Trive Varnish
=============

[](#trive-varnish)

Description
-----------

[](#description)

Magento 2 module which fixes issues with cache tags and 503 errors when using Varnish as caching application.

Installation
------------

[](#installation)

Install via composer:

```
composer require trive/varnish

```

Modify your VCL file with the following content:

```
sub vcl_backend_response {
    ...(redacted)

    # Trive - add these two lines below - start
    # collect all x-magento-tags headers
    std.collect(beresp.http.X-Magento-Tags);
    # Trive - add these two lines above - end"

    return (deliver);
}

```

Enable the module:

```
bin/magento module:enable Trive_Varnish
bin/magento setup:upgrade

```

The issue
---------

[](#the-issue)

When using Varnish as caching application in Magento 2, each page is tagged by cache tags of the content displayed on it. These tags are then used for cache invalidation and purges, once content is updated.

For example, if you open a home page on default installation, it will be tagged with `store, cms_page and cms_page_1` cache tags.

Categories are tagged with cache tags of all products they have assigned. This means that, if you have a large catalog, with a single category containing about 2000 products, you're likely to have about 20kB worth of cache tags when first loading that category.

Cache tags are sent to Varnish as `X-Magento-Tags` header on initial, non-cached request to Varnish, so it can tag the URL with displayed content, and be able to clear all pages where a object appears, when requested.

Once `X-Magento-Tags` header gets longer than 8kB, default `http_resp_hdr_len` Varnish limit is hit and Varnish returns a 503 error to customers (backend fetch failed).

Even after implementing workaround from [Magento Documentation](http://devdocs.magento.com/guides/v2.2/config-guide/varnish/tshoot-varnish-503.html), the issue is not solved, because another limit on Apache/nginx HTTP server might be hit, as they [both](http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestfieldsize) [have](http://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers) 8kB max header value by default.

Affected stores
---------------

[](#affected-stores)

Your store is affected if you are:

- using Magento 2 (any version)
- having a large number of products on store, with at least one anchor category containing at least 2000 products
- using Varnish as Magento 2 caching application, with default `http_resp_hdr_len` limit

Your store might also be affected if you are:

- using Apache/nginx with default `LimitRequestFieldSize`, `large_client_header_buffers`, or some other limit that might be hit by HTTP headers
- using nginx/HAProxy with default header length or request size limits
- [using Apache mod\_proxy\_fcgi](https://maxchadwick.xyz/blog/http-response-header-size-limit-with-mod-proxy-fcgi)

Our solution
------------

[](#our-solution)

This module addresses the above issue by separating `X-Magento-Tags` into 8kB header blocks. Sending multiple `X-Magento-Tags` headers don't hit most of the limits, and doesn't triggers 503, nor `FetchError http read error: overflow` errors during Varnish backend fetch.

Note that default Magento 2 VCL file should be updated after implementing this module, to be able to collect multiple `X-Magento-Tags` headers into one, during Varnish procesing.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3071d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1dad9ddc0122cb97e77adbb64d0540032329a4807eb3b59a417d04a64d1e30fd?d=identicon)[chombe](/maintainers/chombe)

---

Top Contributors

[![chombe](https://avatars.githubusercontent.com/u/2380250?v=4)](https://github.com/chombe "chombe (3 commits)")[![mmenozzi](https://avatars.githubusercontent.com/u/1199914?v=4)](https://github.com/mmenozzi "mmenozzi (1 commits)")[![sambolek](https://avatars.githubusercontent.com/u/5627631?v=4)](https://github.com/sambolek "sambolek (1 commits)")[![wujku](https://avatars.githubusercontent.com/u/1288915?v=4)](https://github.com/wujku "wujku (1 commits)")[![zeljkoprsa](https://avatars.githubusercontent.com/u/10166?v=4)](https://github.com/zeljkoprsa "zeljkoprsa (1 commits)")

---

Tags

magento2-extension-freemagento2-modulevarnish

### Embed Badge

![Health badge](/badges/trive-varnish/health.svg)

```
[![Health](https://phpackages.com/badges/trive-varnish/health.svg)](https://phpackages.com/packages/trive-varnish)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
