Code Monkey home page Code Monkey logo

Comments (7)

danleecreates avatar danleecreates commented on August 20, 2024

Hi @aelvan I have been in contact with Digital Ocean Support regarding the issue...

They said:

The Spaces access keys won't be working for CDN endpoints so you are getting this "AccessDenied" error when uploading files. You have to use the Origin URL "https://ams3.digitaloceanspaces.com" to upload files using Spaces access keys.

I "Think" this does mean we can't use the Endpoint URL with the CDN string like so "https://ams3.cdn.digitaloceanspaces.com" to server images faster. Is this correct and if so is there a way to fix this?

Thanks
Dan

from dospaces.

aelvan avatar aelvan commented on August 20, 2024

It means that the endpoint URL is for contacting the API, and that doesn't have anything to do with what the resulting URL for your images will be, and how fast you load. I haven't tested this, but most likely you should do:

'SPACES_ENDPOINT' => 'https://ams3.digitaloceanspaces.com',
'SPACES_URL' => 'https://test.ams3.cdn.digitaloceanspaces.com',

from dospaces.

danleecreates avatar danleecreates commented on August 20, 2024

Thanks for your reply @aelvan

Ok so the 'SPACES_URL' should be used to load the image in the browser. Are we sure it isn't using the Endpoint URL value?

With the settings defined as you reccomend, we noticed that some pages are not using the cdn string in the image url. See example page here.

But on other pages it is working without issue and the cdn string IS in the URL. See example page.

Any idea what could be the issue?

Here is our settings for the volume.
Screen Shot 2019-05-30 at 10 36 30

from dospaces.

aelvan avatar aelvan commented on August 20, 2024

Doesn't make much sense. You sure there isn't some kind of caching going on here? Are you using template caching or some kind of frontside cache?

from dospaces.

DavidOliver avatar DavidOliver commented on August 20, 2024

I just enabled the CDN by adding .cdn to the Base URL field in the storage settings, and all seems well: uploads in the control panel are still working and the URLs of assets in the frontend pages have the .cdn in them.

Screenshot from 2020-03-06 22-32-18

from dospaces.

estebancastro avatar estebancastro commented on August 20, 2024

I had this issue, I solved (at least work for me, upload the images without problems) with this setup:

.env

SPACES_URL=https://bucket-name.ams3.cdn.digitaloceanspaces.com/
SPACES_API_KEY=MFUU7XQ2NFL7YRRGUVJ1
SPACES_SECRET=De1YF926020n1UL8QyTmgh9n1UL1QyUq5k
SPACES_ENDPOINT=https://ams3.digitaloceanspaces.com
SPACES_REGION=ams3
SPACES_BUCKET=bucket-name

config.php

'@spacesUrl' => App::env('SPACES_URL'),
'@spacesKeyId' => App::env('SPACES_API_KEY'),
'@spacesSecret' => App::env('SPACES_SECRET'),
'@spacesEndpoint' => App::env('SPACES_ENDPOINT'),
'@spacesRegion' => App::env('SPACES_REGION'),
'@spacesBucket' => App::env('SPACES_BUCKET'),

Note: I think the readme file https://github.com/vaersaagod/dospaces/blob/master/README.md should be updated with https://craftcms.com/docs/3.x/config/#aliases because config/volumes.php has been deprecated: https://imgur.com/x7QwmF3

from dospaces.

aelvan avatar aelvan commented on August 20, 2024

In fact, you should rather use environmental variables as that's the new best practice after project config happened.

Closing since the original issue was solved way back when.

from dospaces.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.