vendredi 22 mai 2020

Laravel: Storage link returns invalid url

I am using the following to grab the URL from S3:

$newPath = '/'.id().'/'.$imageType.'-'.$fileName;

$fileUpload = Storage::disk('s3-legacy-apps')->put($newPath, $image->stream()->__toString());

The url this returns is: https://s3.amazonaws.com/s3-legacy-apps/test-bucket/logo-XPo7cVDqftcGasGLfEx8.png

Accessing this url gives me access denied, but if I go to the S3 dashboard for this file, I see the same URL but with the domain and subdomain reversed like this: https://s3-legacy-apps.s3.amazonaws.com/test-bucket/logo-XPo7cVDqftcGasGLfEx8.png and this link works.

adding from filesystems.php:

    's3-legacy-apps' => [
        'driver' => 's3',
        'key'    => env('AWS_S3_KEY'),
        'secret' => env('AWS_S3_SECRET'),
        'region' => env('AWS_S3_REGION'),
        'bucket' => env('AWS_S3_BUCKET'),
    ],


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire