Skip to content

Commit ec74016

Browse files
committed
Update proxy client chapter
1 parent bf546a2 commit ec74016

File tree

2 files changed

+66
-48
lines changed

2 files changed

+66
-48
lines changed

Resources/doc/reference/configuration/invalidation.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ invalidated. By default, any request parameters that are not part of the
5252
invalidated route are ignored. Set ``ignore_extra_params`` to ``false``
5353
to set those parameters anyway.
5454

55-
Some more explanation.
56-
57-
Assume route ``villain_edit`` resolves to ``/villain/{id}/edit``.
55+
A more detailed explanation:
56+
assume route ``villain_edit`` resolves to ``/villain/{id}/edit``.
5857
When a client successfully edits the details for villain with id 123 (at
5958
``/villain/123/edit``), the index of villains (at ``/villains``) can be
6059
invalidated (purged) without trouble. But which villain details page should we

Resources/doc/reference/configuration/proxy-client.rst

Lines changed: 64 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,89 @@
11
Proxy Client Configuration
22
==========================
33

4-
Usually, your application will interact with the caching proxy through the
5-
:doc:`Cache Manager </reference/cache-manager>`. You need to configure a proxy
6-
client for the cache manager to work. The proxy client is also available as a
4+
The proxy client sends invalidation requests to your caching proxy. It must be
5+
configured for the :doc:`Cache Manager </reference/cache-manager>` to work,
6+
which wraps the proxy client and is the usual entry point for application
7+
interaction with the caching proxy. The proxy client is also available as a
78
service (``fos_http_cache.proxy_client``) that you can use directly.
89

9-
.. glossary::
10+
Varnish
11+
-------
1012

11-
``servers``
12-
Comma-separated list of IP addresses or host names of your
13-
caching proxy servers. The port those servers will be contacted
14-
defaults to 6081, you can specify a different port with ``:<port>``.
13+
.. code-block:: yaml
14+
15+
# app/config/config.yml
16+
fos_http_cache:
17+
proxy_client:
18+
varnish:
19+
servers: 123.123.123.1:6060, 123.123.123.2
20+
base_url: yourwebsite.com
21+
22+
servers
23+
"""""""
1524

16-
``base_url``
17-
This must match the web host name clients are using when connecting
18-
to the caching proxy. Optionally can contain a base path to your
19-
application. Used for invalidation with paths.
25+
**type**: ``array``
26+
27+
Comma-separated list of IP addresses or host names of your
28+
caching proxy servers. The port those servers will be contacted
29+
defaults to 6081, you can specify a different port with ``:<port>``.
30+
31+
base_url
32+
""""""""
33+
34+
**type**: ``string``
35+
36+
This must match the web host name clients are using when connecting
37+
to the caching proxy. Optionally can contain a base path to your
38+
application. Used for invalidation with paths.
2039

2140
.. warning::
2241

2342
Double-check ``base_url``, for if it is mistyped, no content will be
2443
invalidated.
2544

26-
.. todo::
27-
28-
**TODO: MOVE** When using ESI, you will want to purge individual fragments. To generate the
29-
corresponding ``_internal`` route, inject the ``http_kernel`` into your controller and
30-
use HttpKernel::generateInternalUri with the parameters as in the twig
31-
``render`` tag.
45+
See the :ref:`FOSHttpCache library docs <foshttpcache:varnish configuration>`
46+
on how to configure Varnish.
3247

33-
Configure for Varnish
34-
---------------------
48+
Nginx
49+
-----
3550

3651
.. code-block:: yaml
3752
3853
# app/config/config.yml
3954
fos_http_cache:
40-
proxy_client:
41-
varnish:
42-
servers: 123.123.123.1:6060, 123.123.123.2
43-
base_url: yourwebsite.com
55+
proxy_client:
56+
nginx:
57+
servers: 123.123.123.1:6060, 123.123.123.2
58+
base_url: yourwebsite.com
59+
purge_location: /purge
4460
45-
Configure for Nginx
46-
-------------------
61+
For ``servers`` and ``base_url``, see above.
4762

48-
.. code-block:: yaml
63+
purge_location
64+
""""""""""""""
4965

50-
# app/config/config.yml
51-
fos_http_cache:
52-
proxy_client:
53-
nginx:
54-
servers: 123.123.123.1:6060, 123.123.123.2
55-
base_url: yourwebsite.com
56-
purge_location: /purge
57-
58-
The options are the same as for Varnish with the addition of the
59-
``purge_location`` used for the "different location" concept of Nginx.
60-
61-
.. tip::
62-
63-
Although its not a common scenario, you can **use Nginx and Varnish in
64-
parallel**. If you need to cache and invalidate pages in both, you can
65-
configure both in this bundle. The CacheManager will however only use the
66-
default client. You can set the default with
67-
``fos_http_client.proxy_client.default: nginx`` (resp. ``varnish``).
66+
**type**: ``string``
67+
68+
Separate location that purge requests will be sent to.
69+
70+
See the :ref:`FOSHttpCache library docs <foshttpcache:nginx configuration>`
71+
on how to configure Nginx.
72+
73+
default
74+
-------
75+
76+
**type**: ``enum`` **options**: ``varnish``, ``nginx``
77+
78+
.. code-block:: yaml
79+
fos_http_cache:
80+
proxy_client:
81+
default: varnish
82+
83+
The default proxy client that will be used by the cache manager.
84+
You can *use Nginx and Varnish in parallel*. If you need to cache and
85+
invalidate pages in both, you can configure both in this bundle.
86+
The cache manager however will only use the default client.
6887

6988
Custom Guzzle Client
7089
--------------------

0 commit comments

Comments
 (0)