Skip to content

Commit 3bc7dcd

Browse files
committed
Clean up debug docs
1 parent 0556854 commit 3bc7dcd

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

doc/testing-your-application.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Enable Assertions
7171
~~~~~~~~~~~~~~~~~
7272

7373
For the `assertHit` and `assertMiss` assertions to work, you should add a
74-
:ref:`custom X-Debug header <varnish_debugging>` to responses served
74+
:ref:`custom X-Cache header <varnish_debugging>` to responses served
7575
by your Varnish.
7676

7777
Usage

doc/varnish-configuration.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ You can do this as
201201
Debugging
202202
~~~~~~~~~
203203

204-
Configure your Varnish to set a debug header that shows whether a cache hit or miss occurred:
204+
Configure your Varnish to set a custom header (`X-Cache`) that shows whether a
205+
cache hit or miss occurred. This header will only be set if your application
206+
sends an `X-Cache-Debug` header.
205207

206208
.. configuration-block::
207209

tests/Functional/Fixtures/varnish-4/debug.vcl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ sub vcl_deliver {
33
# In Varnish 4 the obj.hits counter behaviour has changed, so we use a
44
# different method: if X-Varnish contains only 1 id, we have a miss, if it
55
# contains more (and therefore a space), we have a hit.
6-
if (resp.http.x-varnish ~ " ") {
7-
set resp.http.x-cache = "HIT";
8-
} else {
9-
set resp.http.x-cache = "MISS";
6+
if (resp.http.x-cache-debug) {
7+
if (resp.http.x-varnish ~ " ") {
8+
set resp.http.x-cache = "HIT";
9+
} else {
10+
set resp.http.x-cache = "MISS";
11+
}
1012
}
1113
}

0 commit comments

Comments
 (0)