Removing the slashes does not help

Removing the slashes does not help
16 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
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
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?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Sid
Sid3y ago
How about the Network tab of the DevTools? Try and expand the failing request so I can see the outgoing headers
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
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
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
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
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Sid
Sid3y ago
Yeah, PutObject would perform the same regardless of where you cal it from

Did you find this page helpful?