[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 |

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

  • WPAdmin AWS CDN 》由 WPAdmin 所推出的全新且功能升級的 Amazon Cloudfront 發佈外掛。讓您的網站輕鬆設定 Amazon Cloudfront CDN,現在介面更直覺且使用更靈活。同時支援 Word...。
  • Enable Visual Mode in CloudFront 》當在 CloudFront 中使用 WordPress 時,無法使用「視覺化模式」。, 因為 User-Agent 被改寫了。, 此外掛會檢查 CloudFront-Is-Desktop-Viewer header,以便使...。
  • Clear CloudFront Cache 》這是一個能夠輕鬆刪除 CloudFront 快取的外掛程式。, 只需兩個步驟即可輕鬆完成設置。, * 配置 IAM, * 為此外掛設置一個 CloudFront 分配 ID, 任意章節 1。
  • RocketFront Connect 》總結:RocketFront Connect通過將WP Rocket Cache與AWS CloudFront通過C3 Cloudfront Cache Controller連接,簡化了快取管理,確保最佳內容傳遞。這款外掛需...。
  • Proxy IP Addresses for Cloudfront with Wordfence 》如果你在 WordPress 前面使用了 Cloudfront 並且使用了 Wordfence,那麼這款外掛就是為你而設的。, 如果你沒有向 Wordfence 提供 Cloudfront 的 IP 地址,那...。
  • CDN Linker lite 》此外掛會替換wp-content和wp-includes資料夾下的所有檔案中的部落格網址,因此您可以使用CDN來處理靜態內容來源。 (來源為您的部落格網址。), 您也可以將靜態...。
  • PXP-Press 》這個外掛可以在文章/頁面儲存時自動使 Cloudfront 失效。, PHP 依賴關係, 在使用前需要安裝 PHP XML。在 Linux 環境下,可以使用以下命令安裝:, sudo ap...。
  • Full Site Cache for CloudFront 》如果您的 WordPress 網誌使用 CloudFront 於主要的 WordPress 網域上 (例如:www.example.com),且您希望對未登入使用者做 HTML 頁面的快取,您可以設定這些 ...。
  • CF Preview Fix 》將目前的時間加入到預覽頁面的永久連結中。, 您可以查看非緩存的預覽文章。。
  • FrontPup 》總結:FrontPup 外掛允許您最大化 CloudFront 起源和您的 WordPress 網站之間可用的設置,提供各種功能如設置 no-cache 標頭、公共 Cache-Control 標頭、私人...。
  • {eac}Doojigger Simple CDN Extension for WordPress 》- SimpleCDN是一個Doojigger擴展,可以在您的網站前端頁面上重寫URL,從而從您的內容分發網絡(CDN)而不是從您的WordPress服務器加載特定內容。, - CDN(內...。
  • Peak Uploader to S3 for WPDM 》S3 Uploader是一個擴展WordPress Download Manager插件的外掛程式,可以幫助您上傳文件到Amazon S3,建立储存桶和Cloudfront分佈。, 功能, , 創建Amazon S3儲...。

文章
Filter
Apply Filters
Mastodon