Skip to content

Scaleway Object Storage Integration

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. When creating or configuring a bucket, set its Visibility to Public in Scaleway Console > Object Storage > [bucket] > Bucket settings.

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 (e.g. GET, PUT) and headers (e.g. Authorization).

Configuration

Here’s an example configuration for Scaleway Object Storage:

yaml
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
toml
[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"
json
{
  "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"
    }
  }
}
js
{
  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
    },
  },
}

WARNING

Do not write your Secret Access Key in the configuration file, as it should be kept confidential and not exposed in client-side code. Users will be prompted to enter the key when they use the storage first time, which will be stored securely in the browser’s local storage.

Configuration Properties

PropertyRequiredDescription
access_key_idYesScaleway IAM Access Key ID. Safe to store in config.
bucketYesThe bucket name.
regionYesScaleway region: fr-par, nl-ams, pl-waw, or it-mil.
prefixNoPath prefix within the bucket, e.g. uploads/.
public_urlNoCDN or custom domain URL for asset previews. See CDN / Custom Domain below.

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:

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

WARNING

Do not set public_url to a CDN URL and rely on it for API operations. The CDN endpoint does not support the S3 ListObjects API, so browsing the asset library would stop working. The storage endpoint is always used for listing and uploading; only the asset URLs shown in the CMS change.

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;
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;
img-src     https://my-cdn.example.com;

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

See the CSP documentation for more details.

Accessing the Storage

The Scaleway Object Storage media storage can be accessed through the File and Image fields in Sveltia CMS. Enter your Secret Access Key in the CMS UI when prompted, and you’ll be able to upload new media directly to your bucket or select existing media.

Future Plans

You’ll be able to manage your Scaleway Object Storage files directly from the Asset Library in future releases.

Released under the MIT License.