Skip to content

jcdcdev/jcdcdev.Umbraco.CloudflareMediaCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

45 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

jcdcdev.Umbraco.CloudflareMediaCache

Umbraco Marketplace GitHub License NuGet Downloads

Features

  • Automatically purge Cloudflare cache when media saved
    • Purge by prefix (Cloudflare Pro & Enterprise)
    • Purge all (All Cloudflare plans)
  • Adds cache headers when serving media
    • Respects image cropper

Quick Start

Install Package

dotnet add package jcdcdev.Umbraco.CloudflareMediaCache

Get Cloudflare Zone ID & API Key

You will need a Cloudflare Zone ID and API Key to use this package.

Note: The API Key should have the following permission:

  • Zone.Cache Purge

Configuration

Add the following section to your appsettings.json:

{
  "Cloudflare": {
    "Media": {
      "Cache": {
        "ZoneId": "ZONE_ID",
        "ApiToken": "API_TOKEN",
        "Enabled": true,
        "Mode": "All",
        "MaxAge": 2592000
      }
    }
  }
}

Options

Option Description
ZoneId The Cloudflare Zone ID
Key The Cloudflare API Key
Enabled Whether to enable functionality
Mode The cache mode (All, Prefix)
MaxAge The max-age for cache headers (seconds)

Contributing

Contributions to this package are most welcome! Please read the Contributing Guidelines.

Acknowledgments (thanks!)