Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

X-Cache headers in list.html.twig #242

@fnash

Description

@fnash

It would be interesting displaying Varnish headers (or custom headers) in the profiler with bootstrap badges. I make many GET requests in my app and it would be nice to easily know which requests made hit/miss from Varnish, with Age and Total-Hits.

Any guidelines to make a PR?

Make a new default middleware available

class VarnishCacheMiddleware extends CacheMiddleware
{
    const DEBUG_HEADER = 'X-Cache';
}

with

# GuzzleCollector

                if ($response->hasHeader('X-Cache') && 'HIT' === $response->getHeaderLine('X-Cache')) {
                    if ($response->hasHeader('Age')) {
                        $req['varnish']['age'] = $response->getHeaderLine('Age');
                    }

                    if ($response->hasHeader('X-Cache-Hits')) {
                        $req['varnish']['hits'] = $response->getHeaderLine('X-Cache-Hits');
                    }
                }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions