Skip to content

Commit cdf7c49

Browse files
committed
Merge pull request #161 from FriendsOfSymfony/nginx-debug-header
document x-cache header for nginx
2 parents e3cfab1 + c29863c commit cdf7c49

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

doc/nginx-configuration.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Below you will find detailed NGINX configuration recommendations for the
77
features provided by this library. The examples are tested with NGINX version
88
1.4.6.
99

10-
NGINX cache is a set of key/value pairs. The key is built with elements taken from the requests
10+
NGINX cache is a set of key/value pairs. The key is built with elements taken from the requests
1111
(URI, cookies, http headers etc) as specified by `proxy_cache_key` directive.
1212

13-
When we interact with the cache to purge/refresh entries we must send to NGINX a request which has
13+
When we interact with the cache to purge/refresh entries we must send to NGINX a request which has
1414
the very same values, for the elements used for building the key, as the request that create the entry.
1515
In this way NGINX can build the correct key and apply the required operation to the entry.
1616

@@ -20,8 +20,8 @@ you can use in the key see `this page from the official documentation <http://ng
2020
Purge
2121
~~~~~
2222

23-
NGINX does not support :term:`purge` functionality out of the box but you can easily add it with
24-
`ngx_cache_purge <https://github.com/FRiCKLE/ngx_cache_purge>`_ module. You just need to compile
23+
NGINX does not support :term:`purge` functionality out of the box but you can easily add it with
24+
`ngx_cache_purge <https://github.com/FRiCKLE/ngx_cache_purge>`_ module. You just need to compile
2525
NGINX from sources adding `ngx_cache_purge` with `--add-module`
2626

2727
You can check the script :source:`install-nginx.sh <tests/install-nginx.sh>` to get an idea
@@ -50,3 +50,14 @@ so add a line like the following to your config:
5050
:language: nginx
5151
:lines: 44
5252

53+
.. _nginx_debugging:
54+
55+
Debugging
56+
~~~~~~~~~
57+
58+
Configure your Nginx to set a custom header (`X-Cache`) that shows whether a
59+
cache hit or miss occurred:
60+
61+
.. code-block:: none
62+
63+
add_header X-Cache $upstream_cache_status;

doc/testing-your-application.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Constant Getter Default
7474
Enable Assertions
7575
'''''''''''''''''
7676

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

@@ -104,8 +104,9 @@ Constant Getter Default
104104
Enable Assertions
105105
'''''''''''''''''
106106

107-
For the `assertHit` and `assertMiss` assertions to work, you should add the HTTP
108-
header ``X-Cache`` to your responses
107+
For the `assertHit` and `assertMiss` assertions to work, you need to add a
108+
:ref:`custom X-Cache header <nginx_debugging>` to responses served
109+
by your Nginx.
109110

110111
Usage
111112
-----

doc/varnish-configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Debugging
203203

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

208208
.. configuration-block::
209209

0 commit comments

Comments
 (0)