Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
CORS - Cloudflare Developers
CD
Cloudflare Developers
•
3y ago
•
7 replies
acubesa
CORS
Have been getting 403
[Error
] Origin
http://localhost:3000
is not allowed by Access
-Control
-Allow
-Origin
. Status code
: 403
when trying to PUT to a signedUrl generated from the S3 api
I
'm building it this way
:
const S3
= new S3Client
(
{
region
:
'auto
'
,
endpoint
:
https://${process.env.CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com
https://${process.env.CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com
,
credentials
:
{
accessKeyId
: process
.env
.CLOUDFLARE
_ACCESS
_KEY
_ID
!
,
secretAccessKey
: process
.env
.CLOUDFLARE
_SECRET
_ACCESS
_KEY
!
,
}
,
}
)
;
const response
= await getSignedUrl
(
S3
, new PutObjectCommand
(
{
Bucket
: process
.env
.CLOUDFLARE
_BUCKET
,
Key
: fileName
,
Metadata
:
{
"x
-amz
-meta
-origin
"
:
"
http://localhost:3000
"
}
}
)
,
{ expiresIn
: 3600
}
)
And this is CORS policy in R2
:
[
{
"AllowedOrigins
"
:
[
"
http://localhost:3000
"
]
,
"AllowedMethods
"
:
[
"GET
"
,
"PUT
"
,
"POST
"
,
"HEAD
"
]
,
"AllowedHeaders
"
:
[
"
*
"
]
}
]
Cloudflare Developers
Join
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,436
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
CORS
CD
Cloudflare Developers / r2
3y ago
CORS
CD
Cloudflare Developers / r2
3y ago