Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[Unreleased]: https://github.com/Siteation/magento2-debugbar/compare/1.6.0...main

### Changed

- The user guide recommends Magento's built in full page cache over Varnish while the bar is on. Varnish caches nothing
while the bar is on, and a page it cached before hides the bar.

## [1.6.0] - 2026-11-20

[1.6.0]: https://github.com/Siteation/magento2-debugbar/compare/1.5.3...1.6.0
Expand Down
10 changes: 5 additions & 5 deletions Presentation/BarInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ public function inject(ResponseInterface $response, array $profile): void
$response->clearHeader('Content-Length');
}

/**
* X-Magento-Tags goes with it: Magento's own Varnish configuration decides a response is
* cacheable by the presence of that header, so leaving it would leave the decision to a
* rule that never heard of this module.
*/
/**
* @param array<string, mixed> $profile
*/
Expand All @@ -138,6 +133,11 @@ private function label(array $profile): ?string
return trim(sprintf('%s %s', $magewire['component'], $magewire['action'] ?? ''));
}

/**
* X-Magento-Tags goes with it: Magento's own Varnish configuration decides a response is
* cacheable by the presence of that header, so leaving it would leave the decision to a
* rule that never heard of this module.
*/
private function refuseSharing(HttpResponse $response): void
{
// The same directives Magento's own setNoCacheHeaders() sends, and deliberately not
Expand Down
11 changes: 10 additions & 1 deletion docs/user-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,15 @@ <h2 id="open-in-your-editor"><a class="anchor" href="#open-in-your-editor">Open
bin/magento config:set siteation_debugbar/general/editor_template &#039;myeditor://open?file=%f&amp;line=%l&#039;</code></pre>
<p><code>%f</code> is the absolute file and <code>%l</code> the line. Paths are stored relative to the application root and the link is built in the browser, so your editor never ends up inside a stored profile. If the application runs somewhere your editor cannot see, a container for instance, map the root:</p>
<pre><code>bin/magento config:set siteation_debugbar/general/editor_path_map &#039;/var/www/html:/Users/you/dev/shop&#039;</code></pre>
<h2 id="behind-varnish"><a class="anchor" href="#behind-varnish">Behind Varnish</a></h2>
<p>Switch the store to Magento&#039;s built in full page cache while you use the bar. It still caches, the bar is injected over a cached page, and the <a href="#page-cache">Page cache</a> section can tell you the page was served from the cache:</p>
<pre><code>bin/magento config:set system/full_page_cache/caching_application 1
bin/magento cache:clean full_page</code></pre>
<p>Varnish gains nothing with the bar on. Without a key every request from a local or private address gets the bar, and the address Varnish connects from is one. A page with the bar is marked <code>no-store</code>, so Varnish passes every request to Magento and caches nothing. A page it cached before the bar was switched on is still served from the cache, without a bar.</p>
<p>To test Varnish itself, switch the bar off and Varnish back on:</p>
<pre><code>bin/magento config:set siteation_debugbar/general/enabled 0
bin/magento config:set system/full_page_cache/caching_application 2
bin/magento cache:clean full_page</code></pre>
<h2 id="debugging-a-live-site"><a class="anchor" href="#debugging-a-live-site">Debugging a live site</a></h2>
<p>The configuration switch covers the whole store, which on a live site is the wrong shape: it would turn the bar on for every visitor. The access key is the per request half.</p>
<pre><code>bin/magento config:set siteation_debugbar/general/access_key &quot;$(openssl rand -hex 32)&quot;
Expand Down Expand Up @@ -354,7 +363,7 @@ <h2 id="what-it-costs"><a class="anchor" href="#what-it-costs">What it costs</a>
<p>The bar itself embeds about 1.5 kB of summaries in the page and fetches sections on demand.</p>
<h2 id="troubleshooting"><a class="anchor" href="#troubleshooting">Troubleshooting</a></h2>
<p><strong>No bar on the page.</strong> In order: is it enabled, is the area on the list, is your address on the allowlist, and outside developer mode is a key set and presented. A response that was profiled carries <code>X-Siteation-DebugBar-Profile</code> even when it cannot carry a bar, so the header tells you which half is failing.</p>
<p><strong>No bar behind Varnish.</strong> A Varnish hit never reaches PHP, so no profile is written on ordinary catalog and CMS pages. You will see the bar on pass-through pages: customer, checkout, POSTs. Magento&#039;s built in full page cache is different: <code>launch()</code> still runs and the bar is injected over the cached body.</p>
<p><strong>No bar behind Varnish.</strong> The page was cached by Varnish before the bar was switched on. Switch to the built in full page cache; see <a href="#behind-varnish">Behind Varnish</a>.</p>
<p><strong>The bar looks stale after a module update.</strong> Static asset URLs carry the built file&#039;s mtime, so a hard reload is enough.</p>
<p><strong>A profile id returns &quot;not found&quot;.</strong> It has expired. Profiles last 20 files or 60 minutes, and both bounds are enforced on read.</p>
<p><strong>Findings look wrong after changing a threshold.</strong> Thresholds are read when the profile is written, not when it is displayed. Load the page again.</p>
Expand Down
30 changes: 26 additions & 4 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,30 @@ map the root:
bin/magento config:set siteation_debugbar/general/editor_path_map '/var/www/html:/Users/you/dev/shop'
```

## Behind Varnish

Switch the store to Magento's built in full page cache while you use the bar. It still caches,
the bar is injected over a cached page, and the [Page cache](#page-cache) section can tell you
the page was served from the cache:

```
bin/magento config:set system/full_page_cache/caching_application 1
bin/magento cache:clean full_page
```

Varnish gains nothing with the bar on. Without a key every request from a local or private
address gets the bar, and the address Varnish connects from is one. A page with the bar is
marked `no-store`, so Varnish passes every request to Magento and caches nothing. A page it
cached before the bar was switched on is still served from the cache, without a bar.

To test Varnish itself, switch the bar off and Varnish back on:

```
bin/magento config:set siteation_debugbar/general/enabled 0
bin/magento config:set system/full_page_cache/caching_application 2
bin/magento cache:clean full_page
```

## Debugging a live site

The configuration switch covers the whole store, which on a live site is the wrong shape: it
Expand Down Expand Up @@ -758,10 +782,8 @@ the allowlist, and outside developer mode is a key set and presented. A response
profiled carries `X-Siteation-DebugBar-Profile` even when it cannot carry a bar, so the
header tells you which half is failing.

**No bar behind Varnish.** A Varnish hit never reaches PHP, so no profile is written on
ordinary catalog and CMS pages. You will see the bar on pass-through pages: customer,
checkout, POSTs. Magento's built in full page cache is different: `launch()` still runs and
the bar is injected over the cached body.
**No bar behind Varnish.** The page was cached by Varnish before the bar was switched on.
Switch to the built in full page cache; see [Behind Varnish](#behind-varnish).

**The bar looks stale after a module update.** Static asset URLs carry the built file's
mtime, so a hard reload is enough.
Expand Down
Loading