Coder Social home page Coder Social logo

strapi-provider-aws-s3-cloudfront's Introduction

AWS S3 + CloudFront Upload

Using AWS S3 in combination with Amazon CloudFront offers several benefits over using an S3 bucket as a public content repository. You can get it working in under 2 minutes in your application. EASY!

Features

  • Official AWS SDK integration
  • Use PRIVATE AWS Bucket
  • Adds security by creating a private bucket over a public one.
  • Highly secure

Installation

# using npm
npm install @strapi/provider-upload-aws-s3

Activate the Plugin

Add the folling lines of code in the file: config/plugins.js

module.exports = ({ env }) => ({
  upload: {
    config: {
      provider: "provider-upload-aws-s3-cf",
      providerOptions: {
        s3Options: {
          accessKeyId: env("AWS_ACCESS_KEY_ID"),
          secretAccessKey: env("AWS_ACCESS_SECRET"),
          region: env("AWS_REGION"),
          params: {
            signedUrlExpires: env("AWS_SIGNED_URL_EXPIRES", 15 * 60),
            Bucket: env("AWS_BUCKET"),
          },
          cdn: env("AWS_CDN"),
        },
      },
    },
  },
});

Configure the Strapi Security

Add the folling lines of code in the file: config/middlewares.js. You can comment out or remove the existing strapi::security from the middleware array.

{
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        directives: {
          "script-src": ["'self'", "'unsafe-inline'", "cdn.jsdelivr.net"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "cdn.jsdelivr.net",
            "strapi.io",
            `${env("AWS_BUCKET")}.s3.${env("AWS_REGION")}.amazonaws.com`,
            `${env("AWS_CDN")}`,
          ],
        },
      },
    },
}

Update .env

AWS_ACCESS_KEY_ID=<>
AWS_ACCESS_SECRET=<>
AWS_REGION=<>
AWS_BUCKET=<>
AWS_CDN=<>

Report Bugs/

Any bugs/issues you may face can be submitted as issues in the Github repo.

strapi-provider-aws-s3-cloudfront's People

Contributors

harshad-schbang avatar

Watchers

Arju S Moon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.