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.
SignatureDoesNotMatch 403 on DigitalOcean Spaces UploadFile (leading slash in path)
- UploadFiletool
- AWS Signature V4tool
- SignatureDoesNotMatchproduct
- AWS SDKlibrary
- SociallyDevorganization
- SpacesConnectlibrary
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.
Source: https://github.com/SociallyDev/Spaces-API/issues/6
Source: https://github.com/SociallyDev/Spaces-API/issues/6