1

I am using FileStorage from Laravel to store uploaded files. To get the url of a file I am using:

$url = Storage::url('/test/image.jpg');

It does return the url of the file on Amazon S3, however I want it to return the url of the file on CDN CloudFront.

How can I achieve this?

Thanks all!

alprosoja
  • 15
  • 4
Quy Nguyen Vu
  • 181
  • 2
  • 13

1 Answers1

0

Set url to your cloudfront url in config/filesystems/s3

's3' => [
    'driver' => 's3',
    'key' => env('AWS_KEY'),
    'secret' => env('AWS_SECRET'),
    'region' => env('AWS_REGION'),
    'bucket' => env('AWS_BUCKET'),
    'url' => 'http://xxx.cloudfront.net'
]
bencagri
  • 184
  • 2
  • 13