Removing the slashes does not help

Removing the slashes does not help
22 Replies
Mun
MunOP3y ago
@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": [ "" ] } ]
Sid
Sid3y ago
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
Mun
MunOP3y ago
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": [ "*" ] } ]
Mun
MunOP3y ago
Interesting. When I paste it, it seems to remove the wildcard. Here is a picture of what it looks like
banbanboi
banbanboi3y ago
@sdnts with allow anonymous origin by putting * as its value
Sid
Sid3y ago
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?
banbanboi
banbanboi3y ago
@sdnts I am calling this
banbanboi
banbanboi3y ago
banbanboi
banbanboi3y ago
creating an object and listing an object from a bucket works fine
Sid
Sid3y ago
How about the Network tab of the DevTools? Try and expand the failing request so I can see the outgoing headers
banbanboi
banbanboi3y ago
i also tried this approach same with cors issue
banbanboi
banbanboi3y ago
Sid
Sid3y ago
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
banbanboi
banbanboi3y ago
@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?
banbanboi
banbanboi3y ago
banbanboi
banbanboi3y ago
that nodejs api endpoint consume this
banbanboi
banbanboi3y ago
Sid
Sid3y ago
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?
Mun
MunOP3y ago
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.
Sid
Sid3y ago
POSTs for PutObject aren’t supported currently FWIW, so that is probably not CORS’ fault
banbanboi
banbanboi3y ago
@sdnts performance wise, is it the same if we call the putobject directly using JS fetch, or call it throug node api?
Sid
Sid3y ago
Yeah, PutObject would perform the same regardless of where you cal it from

Did you find this page helpful?