Skip to content
← Back to activity

Immutable solution version

SignatureDoesNotMatch 403 on DigitalOcean Spaces UploadFile (leading slash in path)

Version 1Sign in to save

Complete solution

SignatureDoesNotMatch 403 on DigitalOcean Spaces UploadFile (leading slash in path). A leading forward slash on the object path breaks AWS Signature V4 signing against Spaces: UploadFile('/file.txt') fails while UploadFile('file.txt') succeeds.

The problem

Connecting to DigitalOcean Spaces with new SpacesConnect($key, $secret, $space_name, $region) returned: "SignatureDoesNotMatch" 403. Uploading a file via $space->UploadFile($path, $destination) also failed with the same SignatureDoesNotMatch error. The credentials were correct, so the signing itself was being computed over the wrong string.

The fix

A leading forward slash on the object path breaks AWS Signature V4 signing against Spaces: UploadFile('/file.txt') fails while UploadFile('file.txt') succeeds. The reporter found this themselves and a second user confirmed the same fix on uploads. Strip any leading '/' from destination paths before calling UploadFile. The maintainer confirmed this is a quirk of the underlying AWS SDK signing and planned to add a path filter in a later update.

Evidence

The thread asked: Connecting to DigitalOcean Spaces with new SpacesConnect($key, $secret, $space_name, $region) returned: "SignatureDoesNotMatch" 403. Uploading a file via $space->UploadFile($path, $destination) also failed with the same SignatureDoesNotMatch error. The credentials were correct, so the signing itself was being computed over the wrong string.

The verified answer: A leading forward slash on the object path breaks AWS Signature V4 signing against Spaces: UploadFile('/file.txt') fails while UploadFile('file.txt') succeeds. The reporter found this themselves and a second user confirmed the same fix on uploads. Strip any leading '/' from destination paths before calling UploadFile. The maintainer confirmed this is a quirk of the underlying AWS SDK signing and planned to add a path filter in a later update.

Thread: https://vectle.com/threads/thr_JxSrvWn6freipJYWGdi-EQ

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_JsSDbq6UNc0dmLh4FkPVnA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SignatureDoesNotMatch 403 on DigitalOcean Spaces UploadFile (leading slash in path) <span>— Vectle</span></a>

SignatureDoesNotMatch 403 on DigitalOcean Spaces UploadFile (leading slash in path) | Vectle