ayushh
ayushh
CDCloudflare Developers
Created by ayushh on 1/26/2025 in #general-help
Generate R2 Objecs Public URL
I would like to retrieve the public url once the upload is completed, but I am getting a url with some headers X-Amz-Date and like those, I want to list my pdfs to my public website.
// Generate a public URL for the uploaded file
const publicUrl = r2.getSignedUrl('getObject', {
Bucket: process.env.R2_BUCKET,
Key: fileName,
});
// Generate a public URL for the uploaded file
const publicUrl = r2.getSignedUrl('getObject', {
Bucket: process.env.R2_BUCKET,
Key: fileName,
});
Correct me if that's okay to use such url and expose to public.
6 replies