Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Role Theme Switcher Module role_theme_switcher crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

This module provides an adapter for Drupal's Flysystem to store files in Cloudflare R2 buckets. It utilizes Cloudflare R2's S3-compatible API and integrates with Drupal's file system settings.

Overview

Flysystem Cloudflare R2 provides a Cloudflare R2 storage adapter for the
Drupal Flysystem module. It builds on the Flysystem S3 adapter and registers
an r2 Flysystem driver for storing Drupal-managed files in a
Cloudflare R2 bucket.

Cloudflare R2 exposes an S3-compatible API, but it does not implement every
AWS S3 operation exactly the same way. This module adapts the existing
Flysystem S3 integration for R2 and handles R2's unsupported object ACL
visibility lookup by returning the configured default visibility.

Features

  • Provides a Flysystem adapter plugin with the driver ID r2.
  • Uses Cloudflare R2's S3-compatible API endpoint.
  • Supports public and private Flysystem stream wrappers.
  • Inherits most configuration options from flysystem_s3.
  • Works with Drupal's file system settings and Flysystem stream wrappers.

Requirements

  • Drupal Flysystem
  • Flysystem S3
  • A Cloudflare R2 bucket
  • Cloudflare R2 S3 API credentials

Installation

Install the module and its dependencies with Composer:

composer require drupal/flysystem_cloudflare_r2
drush en flysystem flysystem_s3 flysystem_cloudflare_r2

Configuration

Configure Flysystem stream wrappers in settings.php. The stream
wrapper scheme name must not contain underscores.

$schemes = [
  'r2-public' => [
    'driver' => 'r2',
    'config' => [
      'key' => '[cloudflare-r2-access-key-id]',
      'secret' => '[cloudflare-r2-secret-access-key]',
      'region' => 'auto',
      'bucket' => '[bucket-name]',
      'endpoint' => 'https://[account-id].r2.cloudflarestorage.com',
      'public' => TRUE,
    ],
      'cache' => TRUE,
  ],
];

$settings['flysystem'] = $schemes;

After configuring the stream wrapper, select it on Drupal's file system
settings page at /admin/config/media/file-system.

Cloudflare R2 Notes

  • Use region value auto.
  • Use the endpoint format https://[account-id].r2.cloudflarestorage.com.
  • For private buckets, omit public or set it to FALSE.
  • For public buckets or CDN-backed buckets, set public to TRUE and configure a public bucket URL or custom domain as needed.

Related Modules

Activity

Tracked releases
1
Tracked since
Jul 2026
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0 Stable Jul 6, 2026