[WordPress] 外掛分享: C3 Cloudfront Cache Controller

WordPress 外掛 C3 Cloudfront Cache Controller 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「C3 Cloudfront Cache Controller」是 2015-11-26 上架。
  • 目前有 3000 個安裝啟用數。
  • 上一次更新是 2026-02-18,距離現在已有 7 天。
  • 外掛最低要求 WordPress 4.9.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
  • 有 3 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

hnle | jepser | miyauchi | pacifika | wokamoto | amimotoami | hideokamoto | johnbillion | megumithemes | bartoszgadomski |

外掛標籤

aws | cdn | cloudfront |

內容簡介

3>這是一個簡單的外掛,如果您發布文章,它就會清除所有 Cloudfront 緩存。
您可以輕鬆地在 WordPress 中使用 CloudFront。

Fixture (固定項)

wp_is_mobile()
檢查 CloudFront 標頭的裝置檢視器類型。
現在支援的是 HTTP_CLOUDFRONT_IS_MOBILE_VIEWER 和 HTTP_CLOUDFRONT_IS_TABLET_VIEWER。

預覽網址
在預覽頁面中,外掛程式添加 post_date 查詢以避免 CloudFront 緩存。
並設定 wordpress_loginuser_last_visit cookie 以避免 CloudFront 緩存。

如果使用者登出,則會刪除 wordpress_loginuser_last_visit cookie。

Invalidation(Clear Cache) Page URL (使頁面 URL 無效 (清除快取))

此外掛會將以下頁面 URL 傳送至 CloudFront Invalidation API。

首頁 URL
已發佈文章頁面 URL
類別存檔頁面 URL

AWS IAM Policy 範例
{
"版本: "2012-10-17",
"聲明:[
{
"作用:[
"cloudfront:GetDistribution",
"cloudfront:ListInvalidations",
"cloudfront:GetStreamingDistribution",
"cloudfront:GetDistributionConfig",
"cloudfront:GetInvalidation",
"cloudfront:CreateInvalidation"
],
"效果: "Allow",
"資源: "*"
}
]
}

透過 env vars (環境變量) 添加您的配置

可以定義以下變數來配置外掛程式:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
C3_DISTRIBUTION_ID

可以像以下程式碼一樣將這些變數放入 wp-config.php 中:

php
define( 'AWS_ACCESS_KEY_ID', '' );
define( 'AWS_SECRET_ACCESS_KEY', '' );
define( 'C3_DISTRIBUTION_ID', '' );

Cookie

此外掛設置了名為 wordpress_loginuser_last_visit 的 Cookie 給使用者。
當使用者預覽自己的文章或內容時,它可以防止 CDN 緩存。
當從儀表板登出時,外掛程式會從使用者中刪除此 cookie。

6.1.5

[修正] 將安裝 AWS SDK 改為使用 composer 而非 aws.phar。

6.1.4

[更新] 支援 post_type_archive_link。

6.1.3

[修正] 從 v6.0.0 遺失過濾器 c3_invalidation_items。

6.1.2

[修正] PHP 版本比較問題。

6.1.1

[修正] 外掛停用問題。

6.1.0

[更新] 按 post_ids 刷新快取。

6.0.0

[破壞性變更] 重寫整個代碼。
[更新] 添加 c3_log_cron_invalidation_task 過濾器以顯示 cron 工作記錄。
[更新] 添加 c3_aws_sdk_path 過濾器以更改或刪除捆綁的 AWS SDK 路徑。

5.5.1

[更新] 使用設定子選單替換頂級選單。

5.5.0

[更新] 可以使用定義的變數來進行 AWS 憑證驗證。

5.4.2

[錯誤修正] 在預覽頁面中設置 cookie 路徑。

5.4.1

[錯誤修正] 無效化查詢 cron 事件中的未定義的路徑索引。

5.4.0

[更新] 更新預覽修復外掛程式。

原文外掛簡介

This is simple plugin that clear all cloudfront cache if you publish posts.
You can easy use CloudFront in front of WordPress.
Fixtures

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.
Invalidation(Clear Cache) Page URL
This plugin send following page url to CloudFront Invalidation API.

TOP page URL
Published Post Page URL
Category Archive Page URL

AWS IAM Policy Example
{
"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.
Adding your configuration through env vars
The plugin can be configured by defining the following variables:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
C3_DISTRIBUTION_ID

You 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', '' );

Cookie
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.
7.1.0

[Feature] Add invalidation detail view with modal popup showing invalidation paths, caller reference, and status
[Fix] Fix invalid path returned for post type without archive page

7.0.1

[Update] Improved AWS API call processing for better security and PHP 8.x compatibility

7.0.0

[Breaking Change] Remove AWS SDK dependency and implement custom HTTP CloudFront API client
[Update] Add comprehensive invalidation logging with c3_log_invalidation_list filter
[Update] Add configurable CloudFront region and HTTP timeout settings

6.1.6

[Fix] Fixed PHP 8 syntax errors by adding nullable type hints
[Fix] Fixed deprecation warnings about creation of dynamic properties in Invalidation_Service.php
[Fix] Fixed deprecation warnings about creation of dynamic properties in Cron_Service.php
[Fix] Fixed PHP 7.4 syntax errors in test files

6.1.5

[Fix] Changed to install the AWS SDK using composer instead of aws.phar.

6.1.4

[Update] Support post_type_archive_link

6.1.3

[Fix] Lost filter c3_invalidation_items From v6.0.0

6.1.2

[Fix] php version compare issue

6.1.1

[Fix] Plugin deactivation issue

6.1.0

[Update] Flush cache by post_ids

6.0.0

[Breaking Change] Re-write entire code
[Update] Add c3_log_cron_invalidation_task filter to show cron job Logs
[Update] Add c3_aws_sdk_path filter to change or remove bundled AWS SDK path

5.5.1

[Update] Replace the top level menu with a Settings submenu

5.5.0

[Update] Can use defined variables for AWS Credentials

5.4.2

[Bug fix] Set cookie path in preview page

5.4.1

[Bug fix] Undefined Paths index in invalidation query cron event

5.4.0

[Update] Update preview fix plugin

5.3.4

[Bug fix] Small bug fix

5.3.3

[Change SDK] replace sdk

5.3.2

[Bug fix] Use EC2 role if using as AMIMOTO Managed hosting

5.3.1

[Add filter] Can select AWS SDK version by filter

5.3.0

[Update SDK] Use AWS SDK v3 when you using php 5.6 or later

5.2.1

[For AMIMOTO Managed] bug fix to run by WP-CLI

5.2.0

[Add filter] We can disable to register wp-cron that retry request invalidation.
[Readme] Update readme to see IAM Policy example.

5.1.0

[Update preview fixture] Set cookie to avoid CloudFront cache if user sign in
[Update preview fixture] Unset cookie for avoide CloudFront cache if user sign out

5.0.0

Support CloudFront viewer params on wp_is_mobile().(4.9.0 or later)

4.4.0

Fix small bug
Add some feature for AMIMOTO Managed hosting user

4.3.1

Fix cron interval
add filters 'c3_invalidation_interval, c3_invalidation_cron_interval, c3_invalidation_item_limits.
update default invalidation interval & items.

4.3.0

Schedule cron event if you published many post at the same time

4.2.1

Fix ‘c3_credential’ filter position

4.2.0

Support AMIMOT Dashboard

4.1.0

Show Invalidation Logs

4.0.3

Auto Deploy by Travis

4.0.2

Add WP-CLI param check ( wp c3 flush)
change transient_key

4.0.1

Bug fix ( conflict Nephila Clavata )

4.0.0

Support AWS SDK Version3
Remove action hook -> ‘c3_add_setting_before’
use ‘c3_after_title’ filter hook instead.
Remove action hook -> ‘c3_add_setting_after’
use ‘c3_after_auth_form’ filter hook instead.

3.0.0

Include CF Preview Fix plugin
Rename

2.4.3

Fix Catch Exception BUG

2.4.2

Fix CLI BUG

2.4.1

Fix CLI BUG

2.4.0

Add WP-CLI Command ( Update Settings )

2.3.0

Add WP-CLI Command

2.2.2

Force Invalidation

2.2.1

Fix Typo

2.2.0

Add Filter for using EC2 Instance Role.
Translationable in t.w.org

2.1.1

Fix too many invalidation url error.

2.1.0

Add hook to customize invalidation URL
support new invalidation url, terms.
Manualy invalidation button added

2.0.2

Change AWS SDK
code refactoring by wokamoto
Invalidation URL

2.0.1

Change AWS SDK
code refactoring by wokamoto
Invalidation URL

1.0

Initial released.

6.1.0

[Fix] Plugin deactivation issue

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「C3 Cloudfront Cache Controller」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


2.0.0 | 2.0.1 | 6.1.4 | 6.1.5 | 7.0.0 | 7.0.1 | 7.1.0 | 7.2.0 | 7.3.0 | 7.3.1 | trunk | 7.3.1.1 |

延伸相關外掛(你可能也想知道)

  • SMTP for Amazon SES – YaySMTP 》使用 YaySMTP 通過 Amazon SES 服務器發送 WordPress 郵件, Amazon Simple Email Service(SES)是一個多功能的郵件服務提供商。它也是具有良好郵件傳遞能力...。
  • Media Cloud Sync 》### 總結:, Media Cloud Sync 是一個創新的 WordPress 外掛程式,革命性地改變了媒體互動方式,並提升網站效能。透過這個外掛,您可以將檔案、媒體和圖片從 ...。
  • WPAdmin AWS CDN 》由 WPAdmin 所推出的全新且功能升級的 Amazon Cloudfront 發佈外掛。讓您的網站輕鬆設定 Amazon Cloudfront CDN,現在介面更直覺且使用更靈活。同時支援 Word...。
  • WP on AWS 》透過 4 個簡單的步驟,遷移、複製或轉移網站至 AWS,此軟體允許您透過 WordPress 界面輕鬆管理 AWS Hosting。今天完全免費在 AWS 上查看您的網站!不需要 AWS...。
  • Cache Sniper for Nginx 》Nginx 內建了一個 FastCGI 快取,負責在網頁伺服器層處理反向代理的快取。這個 Cache Sniper for Nginx WordPress 外掛可以讓您在 WordPress 內清除此快取。...。
  • Login with Cognito 》WordPress Login with Cognito 外掛允許使用 AWS Cognito 帳戶憑證登入 ( Single Sign-On ) 到 WordPress。使用此外掛,您可以使用 Cognito SSO ( 單一登入 )...。
  • CloudSearch 》CloudSearch 是一個靈活的外掛,讓您可以在 WordPress 網站中利用 Amazon CloudSearch 的搜索索引功能。, 要使用此外掛,您需要擁有 Amazon Web Services 帳...。
  • S3 Secure URL 》使用簡單的短代碼建立存儲在 Amazon S3 服務中的檔案的臨時連結。, 也提供短代碼產生器(見截圖)。, 閱讀詳細指南,以瞭解如何使用此外掛。, 短代碼用法, 以...。
  • Sync media with AWS S3 CloudFront 》此外掛會掃描你的 WordPress 站點中的媒體上傳目錄,將媒體檔案推送到 AWS S3 存儲桶中。換句話說,WordPress 上傳目錄(預設為 wp-content/uploads)中的檔...。
  • Clear CloudFront Cache 》這是一個能夠輕鬆刪除 CloudFront 快取的外掛程式。, 只需兩個步驟即可輕鬆完成設置。, * 配置 IAM, * 為此外掛設置一個 CloudFront 分配 ID, 任意章節 1。
  • AWS S3 Bucket Browser 》S3 Bucket Browser 允許您利用 Amazon Web Services 的 S3 儲存系統,直接從 S3 的伺服器將檔案提供給訪客使用,瀏覽效率快速且操作容易。您可以透過點擊或面...。
  • Nanomailer for AWS SES 》### 總結:, Nanomailer for AWS SES 是一個簡化的WordPress外掛程式,透過Amazon Simple Email Service (SES)來轉發所有使用wp_mail()發送的郵件。此外掛程式...。
  • Host your blog on S3 or Google Cloud Storage 》此外掛會捕獲您的網誌所有頁面,並將其上傳至 Amazon S3。這樣您可以以非常少的成本來作為靜態頁面方式來維護您的網誌。, 在使用此方式時,請確認您沒有使用...。
  • WP2Cloud 》d 是一款 WordPress 外掛,可協助您將網站部署到雲端儲存,並使用 Cloud Storage Engine (ClouSE) 來實現。使用 WordPress-To-Cloud 解決方案,您可以將所有...。
  • WP easy mail SES 》輕鬆使用 Amazon SES 來傳送電子郵件。, 此外掛重新配置 wp_mail() 函式,並創建了一個選項頁面。, 注意:在使用 Amazon SES 傳送電子郵件之前,您必須驗證電...。

文章
Filter
Apply Filters
Mastodon