Connect Opndrive to DigitalOcean Spaces

Spaces speaks the S3 API, so Opndrive connects with a Spaces access key and the endpoint of the datacenter your Space lives in. Pick that datacenter as the region and the endpoint follows from it.

Step 1, complete

Provider

Selected
DigitalOcean SpacesS3-compatible storage with a built-in CDNChange
2, current step

Add credentials

secret access key is hidden

Defaults to https://nyc3.digitaloceanspaces.com

How this connection is listed when you switch between them. Left blank, it is called “DigitalOcean Spaces”.

Fill in the key, secret and bucket

3, not started

Open your drive

Setting up DigitalOcean SpacesRequired

1. Allow this site in CORS

The Spaces control panel can add CORS rules (your Space, then Settings, then CORS Configurations), but it has no field for exposed headers, and uploads sent in parts need ETag exposed. DigitalOcean points to an XML file applied with s3cmd for that: configure s3cmd for Spaces, save the policy below as cors.xml, and run the command under it with your Space name.

2. Save this as cors.xml

<CORSConfiguration>
  <CORSRule>
    <AllowedOrigin>https://opndrive.app</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>DELETE</AllowedMethod>
    <AllowedMethod>HEAD</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <ExposeHeader>ETag</ExposeHeader>
    <AllowedHeader>*</AllowedHeader>
  </CORSRule>
</CORSConfiguration>

Then apply it:

s3cmd setcors cors.xml s3://YOUR_SPACE

Filled in with the address this page is open at, https://opndrive.app. If you also open Opndrive from another address, add that one too.

3. Permissions the key needs

  • Read/Write/Delete

4. Clean up interrupted uploads

Large files go up in parts. If an upload stops part way, the parts already sent stay in the bucket: billed, and missing from every listing. Opndrive removes them when an upload fails or is cancelled and it can still reach your bucket, but a closed tab or a dropped connection gives it no chance. A lifecycle rule that deletes incomplete multipart uploads after a few days takes care of the rest. How to add the rule

Worth knowing

Create the access key with Limited Access and Read/Write/Delete on this Space only. A Full Access key works too, but it reaches every Space in the account.

DigitalOcean Spaces CORS documentation

If it fails

What each message Opndrive shows means when connecting to DigitalOcean Spaces, and the fix.

  • “Could not reach your storage”

    No answer came back. Open the browser's developer console (F12): a line saying the request “has been blocked by CORS policy” and “No 'Access-Control-Allow-Origin' header is present” means the bucket does not allow this site yet: apply the CORS policy from the setup steps above. With no such line, check the endpoint address and your connection.

  • “Those keys were rejected”

    Your provider did not accept the key. InvalidAccessKeyId means the access key ID does not exist; SignatureDoesNotMatch means the secret does not belong to it. Check both for typos and stray spaces, and that the key has not been deleted. AuthorizationHeaderMalformed is filed here too, but on Amazon S3 it means the region does not match the bucket's, so check the region before the keys.Shown for the error codes InvalidAccessKeyId, SignatureDoesNotMatch, InvalidClientTokenId, UnrecognizedClientException, AuthorizationHeaderMalformed, TokenRefreshRequired, ExpiredToken, and for any other error answered with HTTP status 401.

  • “That bucket was not found”

    NoSuchBucket means no bucket has that name. PermanentRedirect means it exists but has to be reached through a different endpoint, which usually means the region is wrong.Shown for the error codes NoSuchBucket, PermanentRedirect, AuthorizationQueryParameters, and for any other error answered with HTTP status 404.

  • “These keys are not allowed to do that”

    AccessDenied: the provider knows the key, but its policy does not allow the request. Give it the permissions in step 3, on this bucket.Shown for the error codes AccessDenied, AllAccessDisabled, AccountProblem, and for any other error answered with HTTP status 403.

  • “Something went wrong reaching your storage”

    Your provider answered with an error Opndrive does not recognise, such as a server error. Trying again is worth a go; if it keeps happening, the browser console has the request and the provider's own message.

  • Large uploads fail or keep retrying at the end, while small files upload

    Bigger files go up in parts, and finishing the upload needs each part's ETag, which the browser hides unless the CORS policy exposes it. Make sure ETag is in the exposed headers, as it is in the policy above.

Every connection error, explained