S3 CORS

when trying to upload to s3 bucket got this error in my console: "Access to fetch at 'https://kno-buckets.s3.amazonaws.com/profile-photos/51/Kavitha-Rajendran-Mudaliar.jpg' from origin 'https://sms.test' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled." though the image is uploaded on the s3 bucket but can't be retrieved.
Solution:
Do you have visibility set to private on the File component?
Jump to solution
7 Replies
Hussain4real
Hussain4realOP10mo ago
i have it configured already
David | Fortune Validator
You sure it’s configured correctly ? I’m new to s3 etc but I had trouble until I had it correct
Hussain4real
Hussain4realOP10mo ago
yes, this is my cors policy:
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedOrigins": [
"https://sms.test"
],
"ExposeHeaders": [
"x-amz-server-side-encryption",
"x-amz-request-id",
"x-amz-id-2",
"Content-Type"
],
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedOrigins": [
"https://sms.test"
],
"ExposeHeaders": [
"x-amz-server-side-encryption",
"x-amz-request-id",
"x-amz-id-2",
"Content-Type"
],
on my view page if i inspect the element with broken image i can see the correct image url from S3
Solution
David | Fortune Validator
Do you have visibility set to private on the File component?
Hussain4real
Hussain4realOP10mo ago
no setting visibility to private worked
Hussain4real
Hussain4realOP10mo ago
thanks worked on my Mac but on windows returning 404 in the console and network tab fixed needed to include the region in the AWS_URL
Want results from more Discord servers?
Add your server