X-Varnish

The HTTP X-Varnish response header is an unofficial HTTP header added by Varnish Cache containing the transaction ID (VXID) assigned to the client request.

Note

The X- prefix for non-standard headers is deprecated per RFC 6648.

Usage

Varnish Cache assigns a numeric transaction ID (VXID) to every request and backend fetch. The X-Varnish header exposes these IDs in the response, giving operators a way to trace individual transactions through Varnish logs using varnishlog or varnishncsa.

On a cache miss, the header contains a single VXID representing the client request transaction. On a cache hit, the header contains two space-separated VXIDs. The first is the current client request transaction. The second is the transaction ID of the original backend fetch responsible for storing the object in cache. This second ID allows operators to look up when and how the cached object was first populated by cross-referencing Varnish logs.

The VXID values are unsigned integers assigned sequentially by the Varnish instance. Prior to Varnish 7.3, VXIDs were 32-bit, so wrap-around was possible on busy servers. Varnish 7.3 extended them to 64-bit, making reuse far less likely in practice. Each Varnish instance maintains its own counter, meaning VXIDs are only meaningful on the server generating them.

Values

Single ID

A single numeric value indicates a cache miss. The ID belongs to the current client request transaction. Varnish fetched the response from the origin server for this request.

Two space-separated IDs

Two numeric values separated by a space indicate a cache hit. The first value is the current client request transaction. The second value is the VXID of the backend fetch originally responsible for storing the cached object.

Example

A single ID means the request was a cache miss. Varnish forwarded the request to the backend, and the response was served from the origin. The value 50202624 is the transaction ID assigned to this client request.

X-Varnish: 50202624

Two space-separated IDs mean the response was served from cache. The first value 869171651 is the current request transaction. The second value 863431120 is the transaction ID of the backend fetch originally responsible for storing the cached object. Operators trace the second ID in Varnish logs to find details about when and how the object was cached.

X-Varnish: 869171651 863431120

Pairing X-Varnish with X-Cache and X-Cache-Hits gives a complete picture of cache behavior. X-Cache confirms whether the response was a hit or miss, X-Cache-Hits shows the hit count, and X-Varnish provides the transaction IDs for log correlation.

X-Varnish: 475257329 479895872
X-Cache: HIT
X-Cache-Hits: 3

Takeaway

The X-Varnish header exposes Varnish transaction IDs for log tracing and cache debugging. A single ID signals a cache miss, while two IDs signal a cache hit and link back to the original backend fetch.

See also

Last updated: March 6, 2026