Skip to content

Strapi Upload Minio

Elevate your Strapi experience with Minio. integration! Seamlessly upload and manage your assets using Minio, a high-performance object storage solution. Enhance scalability and performance while enjoying the flexibility of Strapi's powerful content management capabilities. Level up your application's storage game with Strapi Upload and Minio integration. ๐Ÿš€๐Ÿ“ฆ

This upload provider uses the JavaScript Minio.Client to upload files to a (self hosted) instance of Minio.

It's compatible with the strapi 4.x.

How to use

Installation

npm i --save strapi-upload-minio-v4

Config

For strapi ce 4.x

// file: ./config/plugins.js
module.exports = ({ env }) => ({
  upload: {
    config: {
      provider: 'strapi-upload-minio-v4',
      providerOptions: {
        accessKey: env('MINIO_ACCESS_KEY', 'Q3AM3UQ867SPQQA43P2F'),
        secretKey: env(
          'MINIO_SECRET_KEY',
          'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
        ),
        bucket: env('MINIO_BUCKET', 'test-2021-09-22'),
        endPoint: env('MINIO_ENDPOINT', 'play.min.io'),
        port: env('MINIO_PORT', 9000),
        useSSL: env('MINIO_USE_SSL', true),
        folder: env('MINIO_FOLDER', 'cms'),
        host: env('MINIO_HOST', 'https://s3.yourdomain.com'),
      },
    },
  },
})

Pictures cannot be displayed?

Mostly because of CSP, you can refer to https://github.com/strapi/strapi/issues/12886

If the image you uploaded is not displayed properly, you need to modify ./config/middlewares.js as follows.

// ./config/middlewares.js
module.exports = [
  'strapi::errors',
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::logger',
  'strapi::query',
  'strapi::body',
  'strapi::favicon',
  'strapi::public',
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': [
            "'self'",
            'data:',
            'blob:',
            'REPLACE_YOUR_MINIO_HOST_HERE',
          ],
          'media-src': [
            "'self'",
            'data:',
            'blob:',
            'REPLACE_YOUR_MINIO_HOST_HERE',
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
]
Let's build

Got a project? Let's scope it.

Tell me what you're building. You'll get back a real approach and what it takes to ship it.