Skip to content

maxmastalerz/strapi-provider-upload-aws-s3-cloudfront

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

This is just a slight change to strapi-provider-upload-aws-s3

Install via

npm install strapi-provider-upload-aws-s3-cloudfront

or

yarn install strapi-provider-upload-aws-s3-cloudfront

config/plugins.js:

module.exports = ({ env }) => {
  //...
  upload: {
    provider: 'strapi-provider-upload-aws-s3-cloudfront',
    providerOptions: {
      accessKeyId: env('AWS_S3_KEY'),
      secretAccessKey: env('AWS_S3_SECRET'),
      region: env('AWS_S3_REGION'),
      params: {
        Bucket: env('AWS_S3_BUCKET'),
      },
      // Fully qualified URL with trailing forwardslash:
      cdn: env('CLOUDFRONT_URL') // eg: "https://abc123tuvwxyz.cloudfront.net/"
    },
  },
  //...
};

config/middlewares.js:

module.exports = [
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "abc123tuvwxyz.cloudfront.net", // Enter your cloudfront domain here
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            "abc123tuvwxyz.cloudfront.net", // Enter your cloudfront domain here
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  "strapi::errors",
];

About

Strapi CMS upload provider using AWS S3 with cloudfront cdn option

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published