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
, ``fos_http_cache.proxy_client.cloudflare`` or ``fos_http_cache.proxy_client.fastly``).
17
17
18
18
If you need to adjust the proxy client, you can also configure the ``CacheManager``
19
19
with a :ref:`custom proxy client <custom_proxy_client>` that you defined as a
@@ -325,6 +325,41 @@ the `AWS Async documentation_`. It can not be used with the ``client`` option.
325
325
Service identifier of a `AsyncAws\CloudFront\CloudFrontClient` client. More information is available on the
326
326
`AWS Async documentation_`. It can not be used with the ``configuration`` option.
327
327
328
+
.. _configuration_fastly_proxy_client:
329
+
330
+
Fastly
331
+
----------
332
+
.. code-block:: yaml
333
+
334
+
# config/packages/fos_http_cache.yaml
335
+
fos_http_cache:
336
+
proxy_client:
337
+
fastly:
338
+
service_identifier: '<my-service-identifier>'
339
+
authentication_token: '<my-authentication-token>'
340
+
soft_purge: true
341
+
342
+
``service_identifier``
343
+
"""""""""""""""""""""
344
+
345
+
**type**: ``string``
346
+
347
+
Identifier for the Fastly service you want to purge the cache for.
348
+
349
+
``authentication_token``
350
+
"""""""""""""""""""""
351
+
352
+
**type**: ``string``
353
+
354
+
Authentication token (API Token) which can be created in the profile section of your account
355
+
356
+
``soft_purge``
357
+
"""""""""""""""""""""
358
+
359
+
**type**: ``boolean`` **default**: ``true``
360
+
361
+
Boolean for doing soft purges or not on tag & URL purging. Soft purges expires the cache unlike hard purge (removal), and allow grace/stale handling within Fastly VCL.
->info('If you configure more than one proxy client, you need to specify which client is the default.')
418
442
->end()
419
443
->arrayNode('varnish')
@@ -518,6 +542,23 @@ private function addProxyClientSection(ArrayNodeDefinition $rootNode)
518
542
->end()
519
543
->end()
520
544
545
+
->arrayNode('fastly')
546
+
->info('Configure a client to interact with Fastly.')
547
+
->children()
548
+
->scalarNode('service_identifier')
549
+
->info('Identifier for your Fastly service account.')
550
+
->end()
551
+
->scalarNode('authentication_token')
552
+
->info('User token for authentication against Fastly APIs.')
553
+
->end()
554
+
->scalarNode('soft_purge')
555
+
->info('Boolean for doing soft purges or not on tag & URL purging. Soft purges expires the cache unlike hard purge (removal), and allow grace/stale handling within Fastly VCL.')
556
+
->defaultValue(true)
557
+
->end()
558
+
->append($this->getFastlyHttpDispatcherNode())
559
+
->end()
560
+
->end()
561
+
521
562
->booleanNode('noop')->end()
522
563
->end()
523
564
->validate()
@@ -536,7 +577,7 @@ private function addProxyClientSection(ArrayNodeDefinition $rootNode)
536
577
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));
537
578
}
538
579
539
-
if (!\in_array($proxyName, ['noop', 'default', 'symfony', 'cloudflare', 'cloudfront'])) {
580
+
if (!\in_array($proxyName, ['noop', 'default', 'symfony', 'cloudflare', 'cloudfront', 'fastly'])) {
540
581
if (!$arrayServersConfigured && !$jsonServersConfigured) {
541
582
thrownewInvalidConfigurationException(sprintf('The "http.servers" or "http.servers_from_jsonenv" section must be defined for the proxy "%s"', $proxyName));
542
583
}
@@ -636,6 +677,35 @@ private function getCloudflareHttpDispatcherNode()
636
677
return$node;
637
678
}
638
679
680
+
privatefunctiongetFastlyHttpDispatcherNode()
681
+
{
682
+
$treeBuilder = newTreeBuilder('http');
683
+
684
+
$node = $treeBuilder->getRootNode();
685
+
686
+
$node
687
+
->addDefaultsIfNotSet()
688
+
->children()
689
+
->arrayNode('servers')
690
+
->info('Addresses of the hosts the caching proxy is running on. The values may be hostnames or ips, and with :port if not the default port. For fastly, you normally do not need to change the default value.')
691
+
->useAttributeAsKey('name')
692
+
->requiresAtLeastOneElement()
693
+
->defaultValue(['https://api.fastly.com'])
694
+
->prototype('scalar')->end()
695
+
->end()
696
+
->scalarNode('base_url')
697
+
->defaultValue('service')
698
+
->info('Default host name and optional path for path based invalidation.')
699
+
->end()
700
+
->scalarNode('http_client')
701
+
->defaultNull()
702
+
->info('Httplug async client service name to use for sending the requests.')
0 commit comments