@@ -298,24 +298,19 @@ keeping previously set Vary options:
298
298
299
299
**type **: ``integer ``
300
300
301
- Set a X-Reverse-Proxy-TTL header for reverse proxy time-outs not driven by ``s-maxage ``.
301
+ Set a X-Reverse-Proxy-TTL header for reverse proxy time-outs not driven by
302
+ ``s-maxage ``. This keeps your ``s-maxage `` free for use with reverse proxies
303
+ not under your control.
302
304
303
- By default, reverse proxies use the ``s-maxage `` of your ``Cache-Control `` header
304
- to know how long it should cache a page. But by default, the ``s-maxage `` is also
305
- sent to the client. Any caches on the Internet, for example at an Internet
306
- provider or in the office of a surfer, might look at ``s-maxage `` and
307
- cache the page if it is ``public ``. This can be a problem, notably when you do
308
- :doc: `explicit cache invalidation </reference/cache-manager >`. You might want your reverse
309
- proxy to keep a page in cache for a long time, but outside caches should not
310
- keep the page for a long duration.
305
+ .. warning ::
311
306
312
- One option could be to set a high ``s-maxage `` for the proxy and simply rewrite
313
- the response to remove or reduce the ``s-maxage ``. This is not a good solution
314
- however, as you start to duplicate your caching rule definitions.
307
+ This is a custom header. You need to set up your caching proxy to respect
308
+ this header. See the FOSHttpCache documentation
309
+ :ref: `for Varnish <foshttpcache:varnish configuration >` or
310
+ :ref: `for the Symfony HttpCache <foshttpcache:symfony cache configuration >`.
315
311
316
- This bundle helps you to build a better solution: You can specify the option
317
- ``reverse_proxy_ttl `` in the headers section to get a special header that you can
318
- then use on the reverse proxy:
312
+ To use the custom TTL, specify the option ``reverse_proxy_ttl `` in the headers
313
+ section:
319
314
320
315
.. code-block :: yaml
321
316
@@ -331,22 +326,3 @@ then use on the reverse proxy:
331
326
s_maxage : 60
332
327
333
328
This example adds the header ``X-Reverse-Proxy-TTL: 3600 `` to your responses.
334
- Varnish by default knows nothing about this header. To make this solution work,
335
- you need to extend your varnish ``vcl_fetch `` configuration:
336
-
337
- .. code-block :: c
338
-
339
- sub vcl_fetch {
340
- if (beresp.http.X-Reverse-Proxy-TTL) {
341
- C{
342
- char *ttl;
343
- ttl = VRT_GetHdr(sp, HDR_BERESP, "\024X-Reverse-Proxy-TTL:");
344
- VRT_l_beresp_ttl(sp, atoi(ttl));
345
- }C
346
- unset beresp.http.X-Reverse-Proxy-TTL;
347
- }
348
- }
349
-
350
- Note that there is a ``beresp.ttl `` field in VCL but unfortunately it can only
351
- be set to absolute values and not dynamically. Thus we have to revert to a C
352
- code fragment.
0 commit comments