In my case, everything can be public! I am hoping to take advantage of that to reduce costs.
In my case, everything can be public! I am hoping to take advantage of that to reduce costs.
allHeaders: true into the aws block as well, next to signQuery: true=]


allHeaders: trueawssignQuery: true=]const r2 = new AwsClient({
accessKeyId: env.CF_ACCESS_KEY_ID,
secretAccessKey: env.CF_ACCESS_KEY_SECRET,
})
const url = new URL(`https://${env.BUCKET_NAME}.${env.CF_ACCOUNT_ID}.r2.cloudflarestorage.com`)
url.pathname = obj.path
url.searchParams.set('X-Amz-Expires', `${60 * 60 * 24 * env.STRUCTURE_EXPIRY}`)
const _signed = await r2.sign(new Request(url, {
method: 'GET',
contentDisposition: `attachment; filename="${obj.name}"`, // <------------------------ Something like this?
}), { aws: { signQuery: true } })
const signed = _signed.urlnew Request(url, {
headers: {
'content-disposition': `attachment; filename="${obj.name}"`
}
})const g_pdf = new PutObjectCommand({
Bucket: "fristroop",
Body: pdf.path,
Key: `halodergisi/dergiler/${pdf.filename}`,
});
await storage.send(g_pdf);