Comments (7)
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.
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.
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.
from dospaces.
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.
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.
from dospaces.
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.
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)
- Converting images to WebP - Overcoming Timeout Errors?
- Region param is unused in generated endpoint requests? HOT 1
- Volume exception when changing asset slug HOT 1
- Reconnecting to a DO Space HOT 1
- [Bug] Duplicate Bucket Name in Endpoint HOT 10
- yii\base\ErrorException: fseek(): stream does not support seeking HOT 1
- Upload Failed Message HOT 1
- Weird behaviour when deleting assets HOT 5
- Issue with Indexing Assets HOT 2
- Plugin/Craft Update: Error when generating bucket Url HOT 3
- Issue with Craft 3.6.0 > 3.6.10? HOT 2
- Slow / Never Ending Spin on Uploading Images > 1MB HOT 1
- Installation fails on Craft 3.7.6 HOT 5
- Integration with imgix & imageOptimize HOT 1
- Can bucket_endpoint be set in the a config?
- Upload failed. The error message was: “Endpoints must be full URIs and include a scheme and host” HOT 4
- Uploading portrait-oriented images loses their orientation HOT 2
- Cache Control not saving HOT 2
- Configure metadata for volume
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dospaces.