@@ -104,7 +104,7 @@ path::
104104 ;
105105
106106You can specify HTTP headers as the second argument to ``purge() ``.
107- For instance:
107+ For instance::
108108
109109 $client
110110 ->purge('/some/path', array('X-Foo' => 'bar')
@@ -114,6 +114,10 @@ For instance:
114114Please note that purge will invalidate all variants, so you do not have to
115115send any headers that you vary on, such as ``Accept ``.
116116
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+
117121Refresh
118122~~~~~~~
119123
@@ -174,3 +178,23 @@ Varnish client::
174178
175179Make sure to add any headers that you want to ban on to your
176180: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