Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup CloudFront url for AWS S3 provider in Strapi

I have installed strapi-provider-upload-aws-s3 and uploaded file to s3 successfully but is there any way we can change the link to cloudfront instead of using s3 ?

strapi": "3.0.0",
"strapi-provider-upload-aws-s3": "^3.0.0",

config/plugins.js

module.exports = ({ env }) => ({
  upload: {
    accessKeyId: "xxxxxxxxxx",
    secretAccessKey: "xxxxxxxx",
    region: "xxxxx",
    params: {
      Bucket: "xxxxx",
    },
    cloudfrontIsEnabled: 'Yes',
    cloudfrontURL: "xxx.cloudfront.net",
  }
}); (edited) 

Found old issue but no luck in the new version

like image 869
raghul Avatar asked Oct 25 '25 05:10

raghul


1 Answers

I don't think it's possible with current version of strapi and strapi-provider-upload-aws-s3

Your best bet is to fork the provider code, change the url here: https://github.com/strapi/strapi/blob/master/packages/strapi-provider-upload-aws-s3/lib/index.js#L38

and add forked provider to your package.json file

"dependencies": {
  ...,
  "strapi-provider-upload-aws-s3": "git+https://github.com/<YOUR_GITHUB_ACCOUNT>/strapi-provider-upload-aws-s3.git"
  ...
}
like image 61
romanmandryk Avatar answered Oct 27 '25 00:10

romanmandryk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!