You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Resources/doc/reference/configuration/proxy-client.rst
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -276,6 +276,55 @@ endpoint for testing purposes.
276
276
277
277
.. _configuration_noop_proxy_client:
278
278
279
+
cloudfront
280
+
----------
281
+
Talking to AWS cloudfront requires the ``jean-beru/fos-http-cache-cloudfront`` library. You need to require this dependency before you can configure the ``cloudfront`` proxy client.
282
+
283
+
.. code-block:: yaml
284
+
285
+
# config/packages/fos_http_cache.yaml
286
+
fos_http_cache:
287
+
proxy_client:
288
+
cloudfront:
289
+
distribution_id: '<my-distribution-id>'
290
+
configuration:
291
+
accessKeyId: '<my-access-key-id>'
292
+
accessKeySecret: '<my-access-key-secret>'
293
+
294
+
.. code-block:: yaml
295
+
296
+
# config/packages/fos_http_cache.yaml
297
+
fos_http_cache:
298
+
proxy_client:
299
+
cloudfront:
300
+
distribution_id: '<my-distribution-id>'
301
+
client: '<my.custom.client>'
302
+
303
+
``distribution_id``
304
+
"""""""""""""""""""
305
+
306
+
**type**: ``string``
307
+
308
+
Identifier for the CloudFront distribution you want to purge the cache for.
309
+
310
+
``configuration``
311
+
"""""""""""""""""
312
+
313
+
**type**: ``array`` **default**: ``[]``
314
+
315
+
Configuration used to instantiate the `AsyncAws\CloudFront\CloudFrontClient` client. More information is available on
316
+
the `AWS Async documentation_`. It can not be used with the ``client`` option.
317
+
318
+
``client``
319
+
"""""""""""""""""
320
+
321
+
**type**: ``string`` **default**: ``null``
322
+
323
+
Service identifier of a `AsyncAws\CloudFront\CloudFrontClient` client. More information is available on the
324
+
`AWS Async documentation_`. It can not be used with the ``configuration`` option.
325
+
326
+
.. _configuration_noop_proxy_client:
327
+
279
328
noop
280
329
----
281
330
@@ -328,3 +377,4 @@ bundle. Please refer to the :ref:`FOSHttpCache library’s documentation <foshtt
->thenInvalid('You can not set both cloudfront.client and cloudfront.configuration')
518
+
->end()
519
+
->end()
520
+
497
521
->booleanNode('noop')->end()
498
522
->end()
499
523
->validate()
@@ -512,7 +536,7 @@ private function addProxyClientSection(ArrayNodeDefinition $rootNode)
512
536
thrownewInvalidConfigurationException(sprintf('You can only set one of "http.servers" or "http.servers_from_jsonenv" but not both to avoid ambiguity for the proxy "%s"', $proxyName));
513
537
}
514
538
515
-
if (!\in_array($proxyName, ['noop', 'default', 'symfony', 'cloudflare'])) {
539
+
if (!\in_array($proxyName, ['noop', 'default', 'symfony', 'cloudflare', 'cloudfront'])) {
516
540
if (!$arrayServersConfigured && !$jsonServersConfigured) {
517
541
thrownewInvalidConfigurationException(sprintf('The "http.servers" or "http.servers_from_jsonenv" section must be defined for the proxy "%s"', $proxyName));
518
542
}
@@ -525,6 +549,12 @@ private function addProxyClientSection(ArrayNodeDefinition $rootNode)
525
549
thrownewInvalidConfigurationException('Either configure the "http.servers" or "http.servers_from_jsonenv" section or enable "proxy_client.symfony.use_kernel_dispatcher"');
526
550
}
527
551
}
552
+
553
+
if ('cloudfront' === $proxyName) {
554
+
if (!class_exists(CloudFront::class)) {
555
+
thrownewInvalidConfigurationException('For the cloudfront proxy client, you need to install jean-beru/fos-http-cache-cloudfront. Class '.CloudFront::class.' does not exist.');
0 commit comments