From 0bbe493407352506d070b36f43bc887f4eb18927 Mon Sep 17 00:00:00 2001 From: WalkingPizza Date: Thu, 18 Aug 2022 10:39:48 +0200 Subject: [PATCH] Add CORS configuration to S3 provider README --- packages/providers/upload-aws-s3/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/providers/upload-aws-s3/README.md b/packages/providers/upload-aws-s3/README.md index 47d1642cfe..d35adc75a8 100644 --- a/packages/providers/upload-aws-s3/README.md +++ b/packages/providers/upload-aws-s3/README.md @@ -124,6 +124,22 @@ module.exports = [ If you use dots in your bucket name, the url of the ressource is in directory style (`s3.yourRegion.amazonaws.com/your.bucket.name/image.jpg`) instead of `yourBucketName.s3.yourRegion.amazonaws.com/image.jpg`. Then only add `s3.yourRegion.amazonaws.com` to img-src and media-src directives. +## Bucket CORS Configuration + +If you are planning on uploading content like GIFs and videos to your S3 bucket, you will want to edit its CORS configuration so that thumbnails are properly shown in Strapi. To do so, open your Bucket on the AWS console and locate the _Cross-origin resource sharing (CORS)_ field under the _Permissions_ tab, then amend the policies by writing your own JSON configuration, or copying and pasting the following one: + +```json +[ + { + "AllowedHeaders": ["*"], + "AllowedMethods": ["GET"], + "AllowedOrigins": ["YOUR STRAPI URL"], + "ExposeHeaders": [], + "MaxAgeSeconds": 3000 + } +] +``` + ## Required AWS Policy Actions These are the minimum amount of permissions needed for this provider to work.