This is simple plugin that clear all cloudfront cache if you publish posts.
You can easy use CloudFront in front of WordPress.
wp_is_mobile()
Check device viewer type by CloudFront header.
Now supports HTTP_CLOUDFRONT_IS_MOBILE_VIEWER and HTTP_CLOUDFRONT_IS_TABLET_VIEWER.
preview url
In preview page, plugin add post_date query to avoid CloudFront cache.
And set wordpress_loginuser_last_visit cookie for avoid CloudFront cache too.
The wordpress_loginuser_last_visit cookie will be removed if user sign out.
This plugin send following page url to CloudFront Invalidation API.
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"cloudfront:GetDistribution",
"cloudfront:ListInvalidations",
"cloudfront:GetStreamingDistribution",
"cloudfront:GetDistributionConfig",
"cloudfront:GetInvalidation",
"cloudfront:CreateInvalidation"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
Note: The cloudfront:GetInvalidation permission is required for viewing detailed invalidation information. If this permission is not granted, the detail view feature will be disabled gracefully without affecting other plugin functionality.
The plugin can be configured by defining the following variables:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYC3_DISTRIBUTION_IDYou can put these variables like the code into the wp-config.php
php
define( 'AWS_ACCESS_KEY_ID', '' );
define( 'AWS_SECRET_ACCESS_KEY', '' );
define( 'C3_DISTRIBUTION_ID', '' );
This plugin set a Cookie named wordpress_loginuser_last_visit to the user.
It prevents CDN caching when the user is previewing his posts or contents.
Once logging out from Dashboard, plugin removes this cookie from user.
c3_log_cron_invalidation_task filter to show cron job Logsc3_aws_sdk_path filter to change or remove bundled AWS SDK pathwp_is_mobile().(4.9.0 or later)'c3_invalidation_interval, c3_invalidation_cron_interval, c3_invalidation_item_limits.