|
1 | 1 | Proxy Client Configuration
|
2 | 2 | ==========================
|
3 | 3 |
|
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 |
7 | 8 | service (``fos_http_cache.proxy_client``) that you can use directly.
|
8 | 9 |
|
9 |
| -.. glossary:: |
| 10 | +Varnish |
| 11 | +------- |
10 | 12 |
|
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 | +""""""" |
15 | 24 |
|
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. |
20 | 39 |
|
21 | 40 | .. warning::
|
22 | 41 |
|
23 | 42 | Double-check ``base_url``, for if it is mistyped, no content will be
|
24 | 43 | invalidated.
|
25 | 44 |
|
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. |
32 | 47 |
|
33 |
| -Configure for Varnish |
34 |
| ---------------------- |
| 48 | +Nginx |
| 49 | +----- |
35 | 50 |
|
36 | 51 | .. code-block:: yaml
|
37 | 52 |
|
38 | 53 | # app/config/config.yml
|
39 | 54 | 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 |
44 | 60 |
|
45 |
| -Configure for Nginx |
46 |
| -------------------- |
| 61 | +For ``servers`` and ``base_url``, see above. |
47 | 62 |
|
48 |
| -.. code-block:: yaml |
| 63 | +purge_location |
| 64 | +"""""""""""""" |
49 | 65 |
|
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. |
68 | 87 |
|
69 | 88 | Custom Guzzle Client
|
70 | 89 | --------------------
|
|
0 commit comments