garrettAG
CDCloudflare Developers
•Created by garrettAG on 6/23/2023 in #workers-help
R2 signed url creation from Worker
The fix for future readers was adding this to the CORS policy
"AllowedHeaders": [
"*"
]
6 replies
CDCloudflare Developers
•Created by garrettAG on 6/23/2023 in #workers-help
R2 signed url creation from Worker
Is there a way I can set the file type to be something other than the default of multipart/form-data? If I leave content-type off the sign url creation and upload the file gets uploaded but the multipart/form-data prevents the file from opening when downloaded.
I have tried setting headers with allHeaders: true, but then the OPTIONS preflight check on the upload returns a 403, strict-origin-when-cross-origin?
const signed = await r2.sign(
new Request(url, {
method: "PUT",
headers: {
'Content-Type': fileType,
'Content-Length': fileSize,
}
}),
{
aws: { signQuery: true, allHeaders: true },
}
);
6 replies
CDCloudflare Developers
•Created by garrettAG on 6/23/2023 in #workers-help
R2 signed url creation from Worker
Thanks
6 replies