Skip to content
Sveltia CMS
Esc
↑↓navigate↵open⌘Jpreview
On this page

Scaleway Object Storage Integration

Use Scaleway Object Storage as an external media storage provider in Sveltia CMS for S3-compatible cloud storage across European and global regions.

Scaleway Object Storage is an S3-compatible object storage service with multi-region availability. Sveltia CMS supports Scaleway Object Storage as a media storage backend with direct browser-to-storage uploads using AWS Signature Version 4 — no backend proxy is required.

Requirements

  • A Scaleway account with a bucket created.
  • A Scaleway API key pair (see Credentials below).

CSP

If your site uses a Content Security Policy (CSP), you need to allow the Scaleway endpoint. See Content Security Policy below for details.

Setup

Credentials

Scaleway uses IAM API keys for authentication. Generate a key pair via Scaleway Console > IAM > API Keys.

The resulting Access Key ID goes in access_key_id in your config. The Secret Access Key is entered by users in the CMS UI when they access the media library for the first time — it is never stored in config.

Public Read Access

Asset preview and download URLs are unsigned direct storage URLs, so objects must be publicly readable. Objects are private by default, even in a bucket whose Visibility is Public, because that setting only controls whether anyone can list them.

Sveltia CMS therefore gives every file it uploads or renames, and every folder it creates, the public-read ACL, so the bucket can stay private. For this to work, the API key’s IAM policy needs the ObjectStorageObjectsWrite or ObjectStorageFullAccess permission set, both of which include the PutObjectAcl permission. If the bucket has a bucket policy, it must allow s3:PutObjectAcl as well.

Objects uploaded by other means, such as the console, stay private unless you make them public, or add a bucket policy that grants s3:GetObject to everyone. Their previews won’t load in the CMS until you do.

CORS

Configure CORS via AWS CLI. See the documentation for details. CORS is required because Sveltia CMS sends custom AWS Signature v4 headers that trigger a preflight request.

Make sure to allow the necessary HTTP methods (GET, PUT and DELETE) and all headers (*), because Sveltia CMS sends the Authorization, x-amz-* and Content-Type headers. The DELETE method and the x-amz-copy-source header are needed to delete and rename files from the Asset Library. If you configured CORS before these operations became available, add them to your existing rule.

Configuration

Here’s an example configuration for Scaleway Object Storage:

media_libraries:
  scaleway_object_storage:
    access_key_id: SCWXXXXXXXXXXXXXXXXXX
    bucket: my-bucket
    region: fr-par
    prefix: cms-uploads/ # Optional
    public_url: https://my-cdn.example.com # Optional, see CDN / Custom Domain below
[media_libraries.scaleway_object_storage]
access_key_id = "SCWXXXXXXXXXXXXXXXXXX"
bucket = "my-bucket"
region = "fr-par"
prefix = "cms-uploads/"
public_url = "https://my-cdn.example.com"
{
  "media_libraries": {
    "scaleway_object_storage": {
      "access_key_id": "SCWXXXXXXXXXXXXXXXXXX",
      "bucket": "my-bucket",
      "region": "fr-par",
      "prefix": "cms-uploads/",
      "public_url": "https://my-cdn.example.com"
    }
  }
}
{
  media_libraries: {
    scaleway_object_storage: {
      access_key_id: 'SCWXXXXXXXXXXXXXXXXXX',
      bucket: 'my-bucket',
      region: 'fr-par',
      prefix: 'cms-uploads/', // Optional
      public_url: 'https://my-cdn.example.com', // Optional
    },
  },
}

Configuration Properties

Property Required Description
access_key_id Yes Scaleway IAM Access Key ID. Safe to store in config.
bucket Yes The bucket name.
region Yes Scaleway region: fr-par, nl-ams, pl-waw or it-mil.
prefix No Path prefix within the bucket, e.g. uploads/. A trailing slash is added if missing. In a File or Image field, it can contain template tags.
public_url No CDN or custom domain URL for asset previews. See CDN / Custom Domain below.
label No Name shown for this storage in the CMS. Top-level only. See Custom Storage Name.

CDN / Custom Domain

By default, asset URLs use the virtual-hosted storage endpoint (https://{bucket}.s3.{region}.scw.cloud/{key}). To serve assets via a CDN or custom domain, set public_url to the base URL of your CDN or domain:

public_url: 'https://my-cdn.example.com'

Content Security Policy

API calls (list, upload) go to https://s3.{region}.scw.cloud. Asset URLs use https://{bucket}.s3.{region}.scw.cloud by default:

connect-src https://s3.fr-par.scw.cloud
            https://my-bucket.s3.fr-par.scw.cloud;
img-src     https://my-bucket.s3.fr-par.scw.cloud;

If using a CDN or custom domain via public_url:

connect-src https://s3.fr-par.scw.cloud
            https://my-cdn.example.com;
img-src     https://my-cdn.example.com;

Replace fr-par and my-bucket with your actual region and bucket name.

The asset host must be in connect-src because the Download and Copy buttons and the text preview in the Asset Library fetch the file from its public URL. For the same reason, a CDN or custom domain must also send CORS headers that allow the CMS origin. Otherwise, downloads fail.

See the CSP documentation for more details.

Accessing the Storage

There are two ways to use Scaleway Object Storage in Sveltia CMS:

File and Image Fields

When editing content entries, users can use File and Image fields to upload and select media on Scaleway Object Storage directly within the entry editor. After entering the Secret Access Key in the CMS UI when prompted, users can upload new media directly to your bucket or select existing media.

Asset Library

Scaleway Object Storage also appears under External Locations in the Asset Library. There, users can browse, search, sort and filter the files in your bucket, and upload, rename, replace, download or delete them without leaving the CMS.

The files and folders are browsed folder by folder:

  • Subfolders are listed ahead of the files.
  • Uploads go to the folder being viewed.
  • Folders can be created, renamed and deleted.

Was this page helpful?