Skip to content

laukatu/strapi-provider-upload-bunnycdn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strapi-provider-upload-bunnycdn

BunnyCDN Upload Provider for Strapi

Configurations

See the using a provider documentation for information on installing and using a provider. And see the environment variables for setting and using environment variables in your configs.

Example

./config/plugins.js

module.exports = ({ env }) => ({
  //...
  upload: {
    config: {
      provider: "strapi-provider-upload-bunnycdn",
      providerOptions: {
        region: env("BUNNYCDN_HOST"),
        apiKey: env("BUNNYCDN_API_KEY"),
        storageZone: env("BUNNYCDN_STORAGE_ZONE"),
        pullZone: env("BUNNYCDN_PULL_ZONE"),
      },
    },
    actionOptions: {
      upload: {},
      delete: {},
    },
  },
  //...
});

.env

BUNNYCDN_HOST: Storage primary Hostname (Inside FTP & API Access).
BUNNYCDN_API_KEY: Storage Password (Inside FTP & API Access).
BUNNYCDN_STORAGE_ZONE: Storage Zone name.
BUNNYCDN_PULL_ZONE: Pull Zone name.

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

module.exports = [
  // ...
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': ["'self'", 'data:', 'blob:', 'dl.airtable.com', env("BUNNYCDN_HOST"), env("BUNNYCDN_PULL_ZONE")],
          'media-src': ["'self'", 'data:', 'blob:', 'dl.airtable.com', env("BUNNYCDN_HOST"), env("BUNNYCDN_PULL_ZONE")],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...
];

About

BunnyCDN Upload Provider for Strapi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published