@@ -103,6 +103,21 @@ path::
103103 ->flush()
104104 ;
105105
106+ You can specify HTTP headers as the second argument to ``purge() ``.
107+ For instance::
108+
109+ $client
110+ ->purge('/some/path', array('X-Foo' => 'bar')
111+ ->flush()
112+ ;
113+
114+ Please note that purge will invalidate all variants, so you do not have to
115+ send any headers that you vary on, such as ``Accept ``.
116+
117+ The above allows you to pass headers that are different between purge requests.
118+ If you want to send headers for all purge requests, such as ``Authorization ``,
119+ use a :ref: `custom Guzzle client <custom Guzzle client >` instead.
120+
106121Refresh
107122~~~~~~~
108123
@@ -163,3 +178,23 @@ Varnish client::
163178
164179Make sure to add any headers that you want to ban on to your
165180:doc: `Varnish configuration <varnish-configuration >`.
181+
182+ .. _custom guzzle client :
183+
184+ Custom Guzzle Client
185+ --------------------
186+
187+ By default, the proxy clients instantiate a `Guzzle client `_ to communicate
188+ with the caching proxy. If you need to customize the requests, for example to
189+ send a basic authentication header, you can inject a custom Guzzle client::
190+
191+ use FOS\HttpCache\ProxyClient\Varnish;
192+ use Guzzle\Http\Client;
193+
194+ $client = new Client();
195+ $client->setDefaultOption('auth', array('username', 'password', 'Digest'));
196+
197+ $servers = array('10.0.0.1');
198+ $varnish = new Varnish($servers, '/baseUrl', $client);
199+
200+ .. _Guzzle client : http://guzzle3.readthedocs.org/
0 commit comments