22 Replies
@sdnts This is what my CORS policy looks like now and I still dont have any luck:
[
{
"AllowedOrigins": [
""
],
"AllowedMethods": [
"DELETE",
"HEAD",
"GET",
"PUT",
"POST"
],
"AllowedHeaders": [
""
]
}
]
I think you misunderstood. I didn’t mean remove the origin entirely, I meant remove the last ‘/‘ from your origins. Without any AllowedOrigins, CORS will definitely not work
Sorry dont know why it wasnt showing the "" but some sort of error on copy/paste. But I did try removing teh trailing "/" and that did not do anything. So I decided to go the nuclear approach and just putting wildcards everywhere. That isn't working either
[
{
"AllowedOrigins": [
""
],
"AllowedMethods": [
"DELETE",
"HEAD",
"GET",
"PUT",
"POST"
],
"AllowedHeaders": [
"*"
]
}
]
Interesting. When I paste it, it seems to remove the wildcard. Here is a picture of what it looks like

@sdnts with allow anonymous origin by putting * as its value
Can you show me your outgoing request? The one that is throwing the CORS error?
Either the ‘fetch’ call you make from the browser or a screenshot of the DevTools Network tab will do.
If there’s a preflight request, can you show me that as well?
@sdnts I am calling this


creating an object and listing an object from a bucket works fine
How about the Network tab of the DevTools? Try and expand the failing request so I can see the outgoing headers
i also tried this approach
same with cors issue


Wait so CORS rules are set on a specific bucket, they won’t apply to your ListBuckets call
Try and send out a bucket-specific request
That’s why listing and creating objects works for you
@sdnts how can we set CORS on all of the buckets and the future bucket that we will going to create?
and why bucket listing is working when I call it through my nodejs api?

that nodejs api endpoint consume this

You can’t set an account-wide CORS rule at the moment
Your Node API call works because Node doesn’t respect CORS
CORS is a browser-only thing
Is there some reason you want to be able to list all buckets in your account from a browser?
I am doing the following and getting a CORS error:
fetch(presignedURL, {
method: "post",
body: formData
}).catch(console.error)
trying to upload a file
Interesting.. changing the "post" to "put" worked.
POSTs for PutObject aren’t supported currently FWIW, so that is probably not CORS’ fault
@sdnts performance wise, is it the same if we call the putobject directly using JS fetch, or call it throug node api?
Yeah, PutObject would perform the same regardless of where you cal it from