Download URLs not working if S3 bucket does not have public access
louiswol94 opened this issue · comments
Hi,
Is it possible to make the "Download" link:
To go to the asset hashed URL (eg https://demo.cpm/assests/2gtbrxeb0xs00k4) instead of the full S3 URL (eg https://S3-URL/bucket/file-name)
Reason is because I disabled "public" access to my buckets, and I uploaded via the S3 adapter using:
'storage' => [
'adapter' => 's3',
'key' => AWS_KEY,
'secret' => AWS_KEY_SECRET,
'bucket' => S3_BUCKET,
//'version' => 'latest',
'region' => S3_REGION,
'options' => [
'ACL' => 'private',
'CacheControl' => 'max-age=604800'
],
'endpoint' => S3_ENDPOINT,
'root' => '/',
'thumb_root' => '/thumbnails',
'root_url' => S3_ROOT_URL,
],
So now I can download the file if I go to "Files" (https://example.com/admin/#/project/files/file-id).
But when I open a collection item where there is a "File field" it tries to go to the S3 File URL on "Download" which is blocked.
Any help would be appreciated.
Kind regards
You need to add a bucket permission policy in the s3 bucket then you can able to download the image. ( Not recommended but try to give full access to the public and check then you will get an idea)