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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
sure, one sec, let me enable that feature again
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Erin
ErinOP2y ago
ok same errors
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
Erin
ErinOP2y ago
nope 403
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Erin
ErinOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
kk, thanks
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
fyi this is the code generating this url, it's from the amazon package, I believe
Erin
ErinOP2y ago
my cors is correct, I think, but let me get it for you
Erin
ErinOP2y ago
Erin
ErinOP2y ago
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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
sure kk added, retrying got a 403 again
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
kk, trying again
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
ya there miiiight be a port involved, but it's not showin the referer
Erin
ErinOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
nope this is all test what url, the r2 one?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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 mins
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
that presigned is only for the temp preview image
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
of course!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
dunno sorry, I could walk through the code, gimme a sec like i said, not my code actually a put
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
but the call that's failing is an OPTIONS
Erin
ErinOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
iut's a signature issue still
Erin
ErinOP2y ago
it's an OPTIONS call
Erin
ErinOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
if I make that temp folder/signed url thing local and not using s3, then the upload works perfectly
Erin
ErinOP2y ago
Erin
ErinOP2y ago
(name is wrong, no extension, yadda yadda, but it IS there) so it's only the OPTIONS call that's a problem
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
(I thought that was a weird request but what do I know...lol) trying now
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
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
Erin
ErinOP2y ago
BOOM
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
this has honestly been one of the best support sessions ever. You're amazing
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
no worries, is it late where you are? (I'm in Vancouver Canada, 3:45pm Sunday)
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Erin
ErinOP2y ago
wow, go to bed! but thanks so so much for your help ha, going to follow on Mastodon!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Mdk
Mdk11mo ago
hey all, i'm having the same problem, not sure what's the solution here ok nevermind, got it thanks!
Want results from more Discord servers?
Add your server