Currently, I have a collection of PDFs stored on S3 and am in the process of developing an app that requires me to display these PDFs based on their object names. For instance, there is a PDF named "photosynthesis 1.pdf" located in the biology/ folder, and I need to present this PDF on domain.com/exams/{biology}/{photosynthesis 1.pdf}
I am seeking advice on how to create a system where when a user visits a specific URL, the corresponding PDF is displayed on the site. If this approach is not feasible, I am open to alternative suggestions. Despite my efforts to research solutions, I have been unable to find a working method as I am relatively new to working with S3.
The current solution I am considering involves using dynamic routes in NextJS (13.4 app router) to extract the path from the object name in S3 and then embed the PDF on the website. While I am comfortable with setting up dynamic routes, I am facing challenges when it comes to fetching the PDF from S3.
I attempted to retrieve the PDF by making API calls and sending GET requests to a pre-signed URL. However, this method proved ineffective as pre-signed URLs have expiration limits, and I prefer not to make the bucket public. As my knowledge of S3 is limited, I may be mistaken in my understanding of the processes involved.
Thank you for your help.