Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Download URLs not working if S3 bucket does not have public access #2409

Open
louiswol94 opened this issue Mar 29, 2021 · 1 comment
Open

Comments

@louiswol94
Copy link

louiswol94 commented Mar 29, 2021

Hi,

Is it possible to make the "Download" link:
Screenshot 2021-03-29 at 14 24 53

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

@groovyrb
Copy link

groovyrb commented Apr 1, 2021

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants