I am trying to upload a file to an s3 compatible object storage (I'm using Minio) but the aws client in laravel doesn't use the url I provided in my .env AWS_URL variable.
AWS_URL=http://192.168.1.22:9000
I am using the artisan built-in server and I already tried clearing the config cache.
My current code is:
$request->videoFile->store('videoFiles', 's3');
I'm getting an error which shows that laravel is trying to connect to the wrong url.
Error executing "PutObject" on "https://myawesomebucket.s3.amazonaws.com/videoFiles/bs20uHPxkprbG6fC6e1B6pHtBiQxwgTmrrDdGP2e.mp4";
The default s3
entry in filesystems.php
looks like this:
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
Although this seems to have worked with minio at one point, the url
property now seems to be ignored completely.
Here is a modified config that works with both minio and S3:
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
// the below 'endpoint' url is actually used:
'endpoint' => env('AWS_URL'),
// prevent bucket name from being added to the hostname:
'bucket_endpoint' => false,
// use older urls:
'use_path_style_endpoint' => true,
],
I referenced these guides to find this information:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With