Question

Presigned URL with custom hostname not working

I am following this to generate a presigned URL for download:

https://docs.digitalocean.com/products/spaces/reference/s3-sdk-examples/#generate-a-pre-signed-url-to-download-a-private-file

It does work as I receive a URL, but it has the DO domain. The format is like this: <region>.digitaloceanspaces.com/<space-name><filename><tokens>

According to the above mentioned Documentation, I can also use my custom (sub)domain.

…then modify the hostname in the URL to be the CDN hostname (<space-name>.<region>.cdn.digitaloceanspaces.com, unless the Space uses a custom hostname).

But If I change the URL to this: “MySubodmain.MyDomain.com/<filename><tokens>” it will throw a “SignatureDoesNotMatch”.

I do have the CNAME on my subdomain correctly setup as I can view non-signed urls without any problem.

As a sidenode: Besides above, the format that the Signed URL comes back is NOT as mentioned in the documentation. The Documention says this: <space-name>.<region>.cdn.digitaloceanspaces.com But it comes like this <region>.digitaloceanspaces.com/<space-name>


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.