The proxy client sends invalidation requests to your caching proxy. The Cache Manager wraps the proxy client and is the usual entry point for application interaction with the caching proxy.
You need to configure a client or define your own service for the cache manager to work.
The proxy client is also directly available as a service
that you can use directly.
If you need to adjust the proxy client, you can also configure the
with a custom proxy client that you defined as a
service. In that case, you do not need to configure anything in the
proxy_client configuration section.
# app/config/config.yml fos_http_cache: proxy_client: varnish: servers: 126.96.36.199:6060, 188.8.131.52 base_url: yourwebsite.com
Comma-separated list of IP addresses or host names of your
caching proxy servers. The port those servers will be contacted
defaults to 80; you can specify a different port with
When using a multi-server setup, make sure to include all proxy servers in this list. Invalidation must happen on all systems or you will end up with inconsistent caches.
The hostname (or base URL) where users access your web application. The base URL may contain a path. If you access your web application on a port other than 80, include that port:
# app/config/config.yml fos_http_cache: proxy_client: varnish: base_url: yourwebsite.com:8000
base_url, for if it is mistyped, no content will be
See the FOSHttpCache library docs on how to configure Varnish.
# app/config/config.yml fos_http_cache: proxy_client: nginx: servers: 184.108.40.206:6060, 220.127.116.11 base_url: yourwebsite.com purge_location: /purge
base_url, see above.
# app/config/config.yml fos_http_cache: proxy_client: symfony: servers: 18.104.22.168:6060, 22.214.171.124 base_url: yourwebsite.com
base_url, see above.
# app/config/config.yml fos_http_cache: proxy_client: default: varnish
If there is only one proxy client, it is automatically the default. Only configure this if you configured more than one proxy client.
The default proxy client that will be used by the cache manager. You can configure Nginx, Varnish and Symfony proxy clients in parallel. There is however only one cache manager and it will only use the default client.
Custom Guzzle Client¶
By default, the proxy client instantiates a Guzzle client to talk with the
caching proxy. If you need to customize the requests, for example to send a
basic authentication header, you can configure a service and specify that in
guzzle_client option of any of the cache proxy clients. A sample
service definition for using basic authentication looks like this:
# app/config/config.yml acme.varnish.guzzle.client: class: Guzzle\Service\Client calls: - [setDefaultOption, [auth, [%caching_proxy.username%, %caching_proxy.password%, basic ]]]