Title: C3 Cloudfront Cache Controller
Author: hide
Published: <strong>2015 年 11 月 27 日</strong>
Last modified: 2026 年 3 月 23 日

---

搜尋外掛

![](https://ps.w.org/c3-cloudfront-clear-cache/assets/banner-772x250.jpg?rev=3337009)

![](https://ps.w.org/c3-cloudfront-clear-cache/assets/icon-256x256.jpg?rev=3337009)

# C3 Cloudfront Cache Controller

 由 [hide](https://profiles.wordpress.org/hideokamoto/) 開發

[下載](https://downloads.wordpress.org/plugin/c3-cloudfront-clear-cache.7.3.2.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/c3-cloudfront-clear-cache/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/c3-cloudfront-clear-cache/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/c3-cloudfront-clear-cache/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/c3-cloudfront-clear-cache/#developers)

 [技術支援](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/)

## 外掛說明

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

## 安裝方式

 1. Activate the plugin through the ‘Plugins’ menu in WordPress
 2. Create IAM user to attach valid IAM Policy for AWS CloudFront
 3. Configure the plugin settings from wp-admin

## 常見問題集

### When it send invalidation request？

If post published,this plugin post invalidation request to CloudFront.

### Custom Implementation

This plugin now uses a custom AWS CloudFront implementation instead of the official
AWS SDK to reduce dependencies and improve performance.

## 使用者評論

![](https://secure.gravatar.com/avatar/641adb12bdac18eb356b0ec6a89a62c687b494c9840fa80ca19d3a4a39a47e3e?
s=60&d=retro&r=g)

### 󠀁[Wow, unexpectedly surprised at how well it works.](https://wordpress.org/support/topic/wow-unexpectedly-surprised-at-how-well-it-works/)󠁿

 [matyssik](https://profiles.wordpress.org/matyssik/) 2022 年 1 月 15 日

Do not be fooled by small number of reviews. This plugin works super well and even
works with the instance profile (no need to supply access/secret keys). It is simple
and does the job as advertised, excellent work! Thanks from saving me a ton of time
to write my own plugin like that.

![](https://secure.gravatar.com/avatar/5f8e015c797808f9a515f3ecbfd2e67d0a6b7450fd8c59138bea5c91ef89663a?
s=60&d=retro&r=g)

### 󠀁[Works well](https://wordpress.org/support/topic/works-well-1417/)󠁿

 [Ant](https://profiles.wordpress.org/ar0berts/) 2018 年 7 月 30 日

Works well and very easy to get going. Occasionally disabled itself when used with
other plugins e.g. backupbuddy. Would be nice to store AWS credentials in wp-config.
php too. Otherwise excellent. Thank you.

![](https://secure.gravatar.com/avatar/29153f81881e3546d428e31d11c18385eba4fb20b5e48a1cdc6f549d1a880ad8?
s=60&d=retro&r=g)

### 󠀁[Works like charm!!!](https://wordpress.org/support/topic/works-like-charm-72/)󠁿

 [freaker2k17](https://profiles.wordpress.org/freaker2k17/) 2017 年 9 月 8 日

Tried a couple of others until I found this amazing simple plugin ! But After I 
enter the credentials there should be some screen… I see a blank page :/ But It 
works!!!

 [ 閱讀全部 3 則使用者評論 ](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈C3 Cloudfront Cache Controller〉的開發相關工作。

參與者

 *   [ hide ](https://profiles.wordpress.org/hideokamoto/)
 *   [ AMIMOTO ](https://profiles.wordpress.org/amimotoami/)
 *   [ DigitalCube Inc. ](https://profiles.wordpress.org/megumithemes/)
 *   [ wokamoto ](https://profiles.wordpress.org/wokamoto/)
 *   [ Takayuki Miyauchi ](https://profiles.wordpress.org/miyauchi/)
 *   [ Hinaloe ](https://profiles.wordpress.org/hnle/)
 *   [ Bartosz Gadomski ](https://profiles.wordpress.org/bartoszgadomski/)
 *   [ jepser ](https://profiles.wordpress.org/jepser/)
 *   [ John Blackbourn ](https://profiles.wordpress.org/johnbillion/)
 *   [ Sander van Dragt ](https://profiles.wordpress.org/pacifika/)

〈C3 Cloudfront Cache Controller〉外掛目前已有 2 個本地化語言版本。 感謝[全部譯者](https://translate.wordpress.org/projects/wp-plugins/c3-cloudfront-clear-cache/contributors)
為這個外掛做出的貢獻。

[將〈C3 Cloudfront Cache Controller〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/c3-cloudfront-clear-cache)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/c3-cloudfront-clear-cache/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/c3-cloudfront-clear-cache/)，
或透過 [RSS](https://plugins.trac.wordpress.org/log/c3-cloudfront-clear-cache/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/c3-cloudfront-clear-cache/)。

## 變更記錄

#### 7.3.2

 * [Fix]
    - Exclude `.cursor` and `.github` from WordPress.org distribution package to
      prevent packaging conflicts
 * [Maintenance]
    - Improve release workflow settings for WordPress.org asset/readme sync stability
    - Update release documentation for branch strategy and version consistency checks

#### 7.3.1

 * [Fix]
    - Improved cache invalidation handling for posts transitioning between published
      and draft states, ensuring proper cache clearing during state changes
    - Enhanced URL detection for more reliable CloudFront invalidation across different
      URL formats
 * [Improvements]
    - Extended support for WordPress subdirectory installations to ensure proper
      cache path handling

#### 7.2.0

 * [Feature] Add 3 new path adjustment hooks for more granular invalidation control:
    - `c3_invalidation_post_batch_home_path` – Customize home path for single post
      invalidation
    - `c3_invalidation_posts_batch_home_path` – Customize home path for multiple
      posts invalidation
    - `c3_invalidation_manual_batch_all_path` – Customize path for manual “clear
      all” operations
 * [Enhancement] Update Hooks.php to support variable arguments in apply_filters
   method
 * [Compatibility] Maintain full backward compatibility with existing c3_invalidation_items
   filter

## 中繼資料

 *  版本 **7.3.2**
 *  最後更新 **3 個月前**
 *  啟用安裝數 **3,000+**
 *  WordPress 版本需求 ** 4.9.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **6.9.4**
 *  PHP 版本需求 ** 7.4 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/c3-cloudfront-clear-cache/)、[Japanese](https://ja.wordpress.org/plugins/c3-cloudfront-clear-cache/)、
   及 [Korean](https://ko.wordpress.org/plugins/c3-cloudfront-clear-cache/).
 *  [將這個外掛本地化為你的母語版本](https://translate.wordpress.org/projects/wp-plugins/c3-cloudfront-clear-cache)
 * 標籤:
 * [aws](https://tw.wordpress.org/plugins/tags/aws/)[cdn](https://tw.wordpress.org/plugins/tags/cdn/)
   [cloudfront](https://tw.wordpress.org/plugins/tags/cloudfront/)
 *  [進階檢視](https://tw.wordpress.org/plugins/c3-cloudfront-clear-cache/advanced/)

## 評分

 4.3 星，滿分為 5 星

 *  [  1 個 5 星使用者評論     ](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/?filter=5)
 *  [  2 個 4 星使用者評論     ](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/reviews/)

## 參與者

 *   [ hide ](https://profiles.wordpress.org/hideokamoto/)
 *   [ AMIMOTO ](https://profiles.wordpress.org/amimotoami/)
 *   [ DigitalCube Inc. ](https://profiles.wordpress.org/megumithemes/)
 *   [ wokamoto ](https://profiles.wordpress.org/wokamoto/)
 *   [ Takayuki Miyauchi ](https://profiles.wordpress.org/miyauchi/)
 *   [ Hinaloe ](https://profiles.wordpress.org/hnle/)
 *   [ Bartosz Gadomski ](https://profiles.wordpress.org/bartoszgadomski/)
 *   [ jepser ](https://profiles.wordpress.org/jepser/)
 *   [ John Blackbourn ](https://profiles.wordpress.org/johnbillion/)
 *   [ Sander van Dragt ](https://profiles.wordpress.org/pacifika/)

## 技術支援

最近 2 個月解決的問題:

     總計 1 個問題，已解決 0 個

 [檢視技術支援論壇](https://wordpress.org/support/plugin/c3-cloudfront-clear-cache/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](http://wp-kyoto.net/)