Reputation: 1
I want to upload images to my AWS bucket using Pre-Signed URLs, I got the URL without any problem, but when I make put a request on it I faced this CORS problem enter image description here
I tried to set my request headers as following :
const res = await fetch(data, {
method: "PUT",
headers: {
"Access-Control-Allow-Headers" : "Content-Type",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "*",
"Content-Type": "multipart/form-data"
},
body: file
})
console.log(res)
I also made changes to my bucket rules as following but unfortunately it didn't work
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"HEAD",
"GET",
"PUT",
"POST"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": [
"ETag",
"x-amz-meta-custom-header"
]
}
]
Upvotes: 0
Views: 480
Reputation: 11
I think that problem is that you can't put wildcard in AllowedOrigins
. You need to specify correct domen name. It works for me.
Upvotes: 1