Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pSouper's avatar

CORS issue with MinIO

I've change my storage to s3 using MinIO on my stack (TALL8 / Jetstream / Sail / MacOS) and can't find the cause of my failing to upload images.

I am using filepond to upload images and they get stuck by a CORS error being thrown...

OPTIONS http://minio:9000/local/livewire-tmp/KTgeXfmYR6RC... is blocked because...

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://minio:9000/local/livewire-tmp/KTgeXfmYR6RC...-.png?x-amz-acl=private&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=sail%2F20210702%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20210702T105837Z&X-Amz-SignedHeaders=host%3Bx-amz-acl&X-Amz-Expires=300&X-Amz-Signature=07a952e8f98ca90103cce194415891f85d3d1574fb68c96a1101b396792bfbcc. (Reason: CORS request did not succeed).

I have tried enabling: config/cors: 'supports_credentials' => true, config/media-library: 'enable_vapor_uploads' => env('ENABLE_MEDIA_LIBRARY_VAPOR_UPLOADS', true),

*I don't know if either are required but it's as per some web posts. *I don't know if MinIO buckets need some special COORS config but can't find anything about it on the web.

FYI: The seeder "uploads" files perfectly so i know the minio is installed and working (maybe not fully?).

Any help of pointers to resolve or debug further would be hugely appreciated. thanks.

0 likes
7 replies
pSouper's avatar

would anyone else have implemented uploading with s3 and come up agaisnt this issue too? and resolved it?

DM-Miguel's avatar

@pSouper I figured it out, Here is my best attempt at explaining what I found and how I got it working.

Livewire creates signed urls for the temp uploads and it seems minio does not support this.

see the warning here: https://laravel.com/docs/9.x/sail#file-storage, and from watching caleb's screencasts (the creator of livewire) it looks like thats how it's done.

In order for this to work you have to store your temp stuff in a local diks.

  1. I published my livewire configuration and made sure to set the key 'disk' -> 'local'
  2. I went into mino and created a bucket, set the bucket to public
  3. Then by reading the documentation https://laravel.com/docs/9.x/sail#file-storage i made sure to set my AWS_URL=http://localhost:9000/local variable. This part got me too, that part on the end of the url the "local" has to match the name of your bucket exactly so if your bucket name is "my_cool_bucket" it should be AWS_URL=http://localhost:9000/my_cool_bucket
  4. Make sure your APP_URL env variable is http://localhost/ or http://127.0.0.1 or if you use an actual domain set it to that.

What i understood from all this is that at least for now you cant use livewire to create temp urls using minio so you're gonna have to using local storage for temp files. probly better anyhow.

I have no idea why this got it working but this is the only way it functioned. It could be due to minio not supporting signed temp urls, it could be maybe livewire only listens to it's own config, or it could be that the app url env variable is not set right. idk.... maybe someone smarter than me will come along and figure it out and /or explain whats going on / patch it. By all means please correct me if I'm way off. Best of luck to you future laravel peeps. Peace!

5 likes
pSouper's avatar

@DM-Miguel many thanks, sorry I hadn't replied sooner.

michaelsantos's avatar

@DM-Miguel Hi, I hadn't seen your post before I started developing a project using Filament (which uses Livewire behind the scenes) + MiniO

The same problem happened and so far there has been no real solution for it. Who knows, maybe there will be an update on this soon.

DoubleClickDesignLtd's avatar

@DM-Miguel You are correct on your finding however I believe we can get a result with this.

From my research I have come to the same conclusion as you. After a bit more Googling I also found that Minio server can allow self sign but it require a few extra steps, which basically entails using assign CAs see documentation here

https://min.io/docs/minio/linux/operations/network-encryption.html?ref=docs-redirect#install-certificates-from-third-party-cas

From what I can tell Self-signed, Internal, Private Certificates, and Public CAs with Intermediate Certificates can be done and is explain on the page. I believe with a bit of work we could create a CA for Minio server that would allow Livewire to use the tmp folder just like you can do on AWS or Digital Ocean Spaces thus removing the need to use your local storage.

How exactly this is done, I'm not 100% sure yet, but I'll do a bit of work on it and see if I can find the missing piece.

DM-Miguel's avatar

Did you ever figure out this problem? came across it myself

1 like
Reppair's avatar

I am also trying the Filament + Medialibrary + MiniO combo, which led me here. Changing the default storage for temporary uploads in the config/livewire.php file does work, as dm-miguel described.

Please or to participate in this conversation.