CORS
hey there folks, I'm trying to use Livewire's tmp upload feature and getting a 403 CORS error on the options call. I do have a CORS policy set to my public bucket. Is this supported right now in R2?
77 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sure, one sec, let me enable that feature again
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
what region should I use? the article I read said region didn't matter
kk, changing now, maybe that will make it work
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ah I had left it where I had it when I was trying S3, changing now and enabling that tmp folder feature of livewire, one moment
thanks for helping
ok same errors
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nope 403
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
this works when it's local
let me try
The request signature we calculated does not match the signature you provided. Check your secret access key and signing method.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ah, this whole thing is done by Laravel, not sure I have control of this
guess we can't use R2 w/ Laravel, which is a shame
well it's done by the s3 package Laravel uses, I imagine
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
kk, thanks
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
fyi this is the code generating this url, it's from the amazon package, I believe
my cors is correct, I think, but let me get it for you
we really really really REALLY want to use R2 for this, so this would be sad if we couldn't
we use CF for everything!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sure
kk added, retrying
got a 403 again
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
kk, trying again
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ya there miiiight be a port involved, but it's not showin the referer
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nope this is all test
what url, the r2 one?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
https://fitco.a7214c5f6e36dff5ea70da5d02409d4e.r2.cloudflarestorage.com/livewire-tmp/t51ouMXhGjguCFYHI9u9PQOQd13aZU-metaZXJpbi0wMi5qcGc%3D-.jpg?x-amz-acl=private&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=27cf266877bfb1ec1ce0d4ca1c4cef4b%2F20230423%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20230423T221712Z&X-Amz-SignedHeaders=host%3Bx-amz-acl&X-Amz-Expires=300&X-Amz-Signature=fec67c82dafb009751644475701c46d6a6d6e2223d501eb964bcb099cf821d3e
might be out of time though, go fast, I can make another one...you only have 5 minsUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
I can't change that I don't think, let me see
maybe it's a day, not sure on the code path, sorry
none of this code is mine, it's all in various packages
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I was using this article: https://medium.com/@antoine.lame/cloudflare-r2-storage-with-laravel-in-5-minutes-553a5403c6f8
and I've made my bucket public
(though I don't know if I need that yet.....)
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and I"m using Livewire: https://laravel-livewire.com/docs/2.x/file-uploads#basic-upload
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that presigned is only for the temp preview image
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
of course!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that url is for getting the temp url for the preview image, before the image is actually uploaded
so it temporarily uploads to a temp folder, generates a temp url, then you can use that show a preview image
then on save, we actually try to store it on R2
if set the preview stuff to local, but try to store the image, it would likely work
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
dunno sorry, I could walk through the code, gimme a sec
like i said, not my code
actually a put
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
but the call that's failing is an OPTIONS
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
iut's a signature issue still
it's an OPTIONS call
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
if I make that temp folder/signed url thing local and not using s3, then the upload works perfectly
(name is wrong, no extension, yadda yadda, but it IS there)
so it's only the OPTIONS call that's a problem
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
(I thought that was a weird request but what do I know...lol)
trying now
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
in Laravel you have storage "disks". They can be local or external (S3, FTP, DropBox, etc)
and Livewire uses that disk to store a temp file to show you the preview
anyway, trying the headers thing
BOOM
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
this has honestly been one of the best support sessions ever. You're amazing
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
no worries, is it late where you are?
(I'm in Vancouver Canada, 3:45pm Sunday)
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
wow, go to bed!
but thanks so so much for your help
ha, going to follow on Mastodon!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
hey all, i'm having the same problem, not sure what's the solution here
ok nevermind, got it
thanks!