Sail - MinIO - Access to Files in Bucket From Browser #40188
Replies: 2 comments 3 replies
-
The only way i can get it to work is by adding this to the
|
Beta Was this translation helpful? Give feedback.
-
With Laravel 11 at least, you can set the filesystem config S3 option of http_handler and pass in the CONNECT_TO param to the underlying curl, redirecting the request at the last moment to minio within PHP, which leaves things like signed urls returning the endpoint as actually localhost, which is where the browser can reach it. For example: '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'),
'endpoint' => 'http://localhost:9000',
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'http_handler' => new \Aws\Handler\GuzzleV6\GuzzleHandler(
new \GuzzleHttp\Client([
'curl' => [
CURLOPT_CONNECT_TO => ['localhost:9000:minio:9000'],
]
])
),
], This requires the AWS client of V3 (for the http_handler config param), PHP 7.0.7+ and curl 7.49.0+ and won't work with |
Beta Was this translation helpful? Give feedback.
-
Hi.
My aim is to use Sail with MinIO for local dev.
In an attempt to troubleshoot in a clean install; I have a default Laravel install (
"laravel/framework": "^8.75"
) with Sail ("laravel/sail": "^1.0.1"
).One odd thing is I had to require
"league/flysystem-aws-s3-v3": "~1.0"
, newer versions did not install.In any case, I am able to write an upload feature that saves the files to the MinIO bucket storage;
The issue I am facing is I can't view the files in the browser. The
$path
above is correct, but when added to<img>
the display is the broken image, and when attempting to navigate directly to the image;http://minio:9000/local/content/X8l8M5TyLwDQsijHq9bojrTvLfh9hNfT9C9BP4GF.jpg
the browser always says;
This site can’t be reached minio’s server IP address could not be found.
If i switch out the domain to
localhost
or127.0.0.1
i get access denied XML response.I am developing on a MacBook Air M1.
Can someone suggest where I have gone wrong?
Beta Was this translation helpful? Give feedback.
All reactions