Report this

What is the reason for this report?

S3 CDN endpoint does not seem to work with Presigned-URL generated from application code

Posted on March 6, 2025

I have two endpoints to that generates presigned-urls to put image to S3 and get image from it and everything worked just fine. However, recently I changed the url to the CDN url and nothing has been working. I always get “SignatureDoesNotMatch” error in the response message. I did not change anything other than changing the original endpoint to the CDN endpoint

This works: https://<my bucket name>.sgp1.digitaloceanspaces.com/image/e5acd8e0-abd4-4a99-8035-0c02726ca3fd.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=DO8016JJF4Z8QE87D2DM%2F20250306%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250306T061946Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=d35bf14de0e83993f7cf00f9daa27158590388eaf9ba02f0e8980689abd57163

This does not work: https://<my bucket name>.sgp1.cdn.digitaloceanspaces.com/image/e5acd8e0-abd4-4a99-8035-0c02726ca3fd.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=DO8016JJF4Z8QE87D2DM%2F20250306%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250306T062027Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=7db459a5b4b764cb2689caceb84b15d6480d09eb71ba05a6a46af461be008797

Error message:

<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
<Resource>panglot-media/image/6b2d0768-de52-4936-9c23-eb6855437b6e</Resource>
<RequestId>not available</RequestId>

</Error>


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!

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.

Heya, @matthewhuang

If you want to serve images via the CDN without signing mismatches:

  1. Set up a custom domain (CNAME) pointing to your CDN URL.
  2. Use that custom domain in your presigned URLs.

https://docs.digitalocean.com/products/spaces/how-to/customize-cdn-endpoint/

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.