Download the PHP package liftric/kirby-cloudfront-invalidations without Composer
On this page you can find all versions of the php package liftric/kirby-cloudfront-invalidations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download liftric/kirby-cloudfront-invalidations
More information about liftric/kirby-cloudfront-invalidations
Files in liftric/kirby-cloudfront-invalidations
Package kirby-cloudfront-invalidations
Short Description Kirby plugin for automatic slug invalidation in AWS CloudFront
License MIT
Informations about the package kirby-cloudfront-invalidations
kirby-cloudfront-invalidations
Kirby plugin for automatic slug invalidation in AWS CloudFront
Installation
Composer
Setup
If you rely on the default credential provider chain, you just need to set the distributionId
:
Options
liftric.cloudfrontinvalidations.distributionID
This must be set to your AWS CloudFront distribution ID (available in the AWS CloudFront Distributions dashboard).
liftric.cloudfrontinvalidations.awsAccessKeyID
(optional) This can be set to the AWS access key ID of your AWS account, if you are not using the default credential provider chain.
liftric.cloudfrontinvalidations.awsSecretAccessKey
(optional) This can be set to the AWS secret access key of your AWS account, if you are not using the default credential provider chain.
liftric.cloudfrontinvalidations.dependantUrlsForPage
(optional) This must be a function that returns what URL(s) should be cleared after a page modification.
liftric.cloudfrontinvalidations.dependantUrlsForFile
(optional) This must be a function that returns what URL(s) should be cleared after a file modification.
liftric.cloudfrontinvalidations.dependantUrlsForSite
(optional) This must be a function that returns what URL(s) should be cleared after a site modification.
Example config
An some more advanced config, we use a larger dependantUrlsForPage
function to collect from the old page as well the new page all related pages, considers the search
page and prepares the urls for both languages, de
and en
. Of course this example could be much cleaner and maybe a bit more generic in some circumstances but should only demonstrate a different use case.
In addition to that, we also exclude the /api
route from caching by sending a custom header which disallows caching. Having done both, we are able to use AWS CloudFront for a larger customer without any problems.
License
MIT
Kudos
- Neil Daniels of The Streamable for creating the kirby-clear-cloudflare-cache plugin which basically served as a blueprint for this plugin.