Skip to content

Clean up debug docs #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2015
Merged
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
2 changes: 1 addition & 1 deletion doc/testing-your-application.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Enable Assertions
~~~~~~~~~~~~~~~~~

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

Usage
Expand Down
4 changes: 3 additions & 1 deletion doc/varnish-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ You can do this as
Debugging
~~~~~~~~~

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

.. configuration-block::

Expand Down
10 changes: 6 additions & 4 deletions tests/Functional/Fixtures/varnish-4/debug.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ sub vcl_deliver {
# In Varnish 4 the obj.hits counter behaviour has changed, so we use a
# different method: if X-Varnish contains only 1 id, we have a miss, if it
# contains more (and therefore a space), we have a hit.
if (resp.http.x-varnish ~ " ") {
set resp.http.x-cache = "HIT";
} else {
set resp.http.x-cache = "MISS";
if (resp.http.x-cache-debug) {
if (resp.http.x-varnish ~ " ") {
set resp.http.x-cache = "HIT";
} else {
set resp.http.x-cache = "MISS";
}
}
}