Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Presigned URLs - Cloudflare Developers
CD
Cloudflare Developers
•
3y ago
•
10 replies
Jeff
Presigned URLs
I need some help
-
- I
'm trying to generate a presigned upload URL with R2 and I keep getting this error
:
"The request signature we calculated does not match the signature you provided
. Check your secret access key and signing method
.
"
My go code is as follows
:
func CreatePreSignedUploadURLR2
(
)
(string
, error
)
{
iSess
, err
:
= session
.NewSession
(cloudflareR2Config
)
if err
!
= nil
{
return
"
"
, err
}
sess
:
= session
.Must
(iSess
, nil
)
svc
:
= s3
.New
(sess
)
r
,
:
= svc
.PutObjectRequest
(
&s3
.PutObjectInput
{
ACL
: aws
.String
(
"public
-read
"
)
,
Bucket
: aws
.String
(
"bucket
-name
"
)
,
Key
: aws
.String
(
"file
.png
"
)
,
}
)
url
, err
:
= r
.Presign
(10
* time
.Hour
)
return url
, err
}
I have similar code where I use the same R2 config and upload files like this and it works fine
:
uploader
:
= s3manager
.NewUploader
(sess
)
, err
= uploader
.Upload
(
&s3manager
.UploadInput
{
ACL
: aws
.String
(
"public
-read
"
)
,
Bucket
: bucket
,
Key
: key
,
Body
: bytes
.NewReader
(file
)
,
ContentType
: aws
.String
(ContentType
)
,
}
)
Any ideas what I could be doing wrong
?
This is what the pre
-signed URL looks like
:
https://accountid.r2.cloudflarestorage.com/bucket-name/file.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=b4053e91cf47c2e60fc0913379392611%2F20230815%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20230815T005722Z&X-Amz-Expires=36000&X-Amz-SignedHeaders=host%3Bx-amz-acl&X-Amz-Signature=cdfeef86ea408de67dfe70ce89444dc6ad5957fcd938507f0cd0d672679fccbf
Cloudflare Developers
Join
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
86,529
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
R2 presigned urls
CD
Cloudflare Developers / r2
3y ago
Presigned URLs · Cloudflare R2 docs
CD
Cloudflare Developers / r2
13mo ago
Presigned POST no
CD
Cloudflare Developers / r2
4y ago
you can use presigned for GET and PUT
CD
Cloudflare Developers / r2
2y ago