Download Images from URL
I'm trying to setup a button where I am able to just click a button and download a image from my bucket. It has public access ( you can view the objects in the bucket ) but only through the url and not requests.
Anyways I am trying to do this through my website and im getting CORS policy error
I dont really wanna mess with CORS policy or else ima mess something up but is there something im missing or a setting to let you to be able to download images?
10 Replies
BUMP
You're missing a cors policy and you'll have to set one, not another easy way around that
Theres a UI in the R2 dashboard for setting a policy
Also documentation here https://developers.cloudflare.com/r2/buckets/cors/#add-cors-policies-from-the-dashboard
Configure CORS · Cloudflare R2 docs
Cross-Origin Resource Sharing (CORS) is a standardized method that prevents domain X from accessing the resources of domain Y. It does so by using …
thanks for the reply i recently tried it
let me see what i have setup right now
i still get the same error
this is what my download function looks like
AllowedOrigins is not valid. It must be in the following format:
scheme://host[:port] (where port is optional)
cant i just use * to allow anyone?
you want everybody on the internet to be able to download your content from their own apps?
just add your local dev environment in there:
http://localhost:8787
and your app DNS:
https://yourApp.com
add both GET and OPTION as AllowedMethods and you should be good to go
ok
going to give it a try thanks