• Product

  • Solutions

  • Developers

  • Docs

  • Pricing

  • Cloud

Search icon
Strapi plugin logo for Qiniu Cloud

Qiniu Cloud

A provider for strapi server to upload file to Qiniu Cloud

provider-upload-qiniu-cloud

A provider for strapi server to upload file to Qiniu Cloud

Requirements

  • Node.js >= 14
  • npm > 8

Installation

$ npm install provider-upload-qiniu-cloud --save

or

$ yarn add provider-upload-qiniu-cloud --save

For more details, please see: https://strapi.io/documentation/developer-docs/latest/development/plugins/upload.html#using-a-provider

Usage

Strapi v4

The lastest version of the provider supports v4 by default. See example below for ./config/plugins.js:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module.exports = ({ env }) => ({
  upload: {
    config: {
      provider: 'provider-upload-qiniu-cloud', // full package name is required
      providerOptions: {
        accessKey: env('ACCESS_KEY', ''),
        secretKey: env('SECRET_KEY', ''),
        prefix: env('PREFIX', ''),
        zone: env('ZONE', 'Zone_z0'),
        bucket: env('BUCKET', ''),
        publicBucketDomain: env('PUBLIC_BUCKET_DOMAIN', ''),
        https: env('HTTPS', true),
        cdn: env('CDN', false),
      },
    },
  },
});

Official documentation here

Security Middleware Configuration

Due to the default settings in the Strapi Security Middleware you will need to modify the contentSecurityPolicy settings to properly see thumbnail previews in the Media Library. You should replace strapi::security string with the object bellow instead as explained in the middleware configuration documentation.

./config/middlewares.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module.exports = [
  // ...
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': ["'self'", 'data:', 'blob:', '*'],
          'media-src': ["'self'", 'data:', 'blob:', '*'],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...
];

Provider Options

Propertytypevalue
accessKeystring<qiniu access key id>
secretKeystring<qiniu access key secret>
bucketstringbucket name
prefixstringdir name in bucket
zonestringqiniu region (see Qiniu Development Documentation below)
publicBucketDomainstringcustom origin domain name for accessing the uploaded file, e.g. // example: http://if-pbl.qiniudn.com
httpsbooleanDomain with or without https
cdnbooleanWhether to use cdn acceleration when uploading

Qiniu Development Documentation

https://developer.qiniu.com/kodo/1289/nodejs

Install now

npm install provider-upload-qiniu-cloud

STATS

4 GitHub stars2 weekly downloads

Last updated

86 days ago

Strapi Version

Unavailable

Author

github profile image for WilliamYang
WilliamYang

Related plugin

Upload

Useful links

Create your own plugin

Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.