SpatieMediaLibrary plugin CORS issue@
Hi everyone
I'm using Spatie's Media Library to manage my images in Filament. I did setup an S3 bucket with the following CORS policy:
`
When I upload an image in Filament I still get a CORS issue. How can I solve this?
19 Replies
This is how I usually configure it.
(I don't like using
*
in the AllowedOrigins, so I put both my production URL and local-testing URL, unless I'm using separate buckets for those separate purposes, in which case I put the specific URL instead).I see, but what I have should work no?
I did setup it in my env like this:
FILESYSTEM_DISK=s3
FILAMENT_FILESYSTEM_DISK=s3
I get an error when it tries to upload it to the livewire-tmp folder
Have you tried specifically adding your
.be
domain to the AWS AllowedOrigins array?I'll try that now, getting error now. But I also changed my FILESYSTEM_DISK to local again and specific ->disk('media') on the form element now.
Local disk cannot be accessed like this. Change disk to public.
s3 should be fine as long as your s3 permissions are set up correctly.
It is set as public
I'm just really confused, I don't need to add on the form element right? I just want to upload these images on my public bucket.
You may still need it.
Iirc there’s a caveat with s3 uploads if the livewire temp folder isn’t also set to s3.
Preferably I want the livewire-tmp folder to be on the bucket too but it doesn't work and its related to this I believe: https://github.com/filamentphp/filament/discussions/4483
GitHub
S3 cors · filamentphp filament · Discussion #4483
Local and remote same problem, added bucket Cors config: [ { "AllowedHeaders": [ "Authorization" ], "AllowedMethods": [ "GET", "HEAD", "PUT&qu...
If you change the tmp directory in the livewire config I would expect it all to work correctly.
Aha, didn't try that yet. Will give it a try
Again, depending on the bucket being configured correctly on the Aws side.
That should be all good. Thanks for the tip 🙂
I don’t use Aws though. So my help here is limited.
Didn't work unfortunately.. Will take a break from it for now haha
Always a good idea.
Ok fixed the CORS issue. I took the example from AWS again, replaced it with my data and it works now. But now I am still stuck with the Spatie Library not able to access my media disk in my flysystem config
Deleting fixes it but I don't get why. Isn't that the purpose of the Spatie Media Library to have files uploaded to S3 which are publicly accessed?