Is there a way to read an AWS file upload's Access Control List (ACL) from the client (specifically React/Next.js) if it is not set to 'public-read'?

Is there a way to upload private files to AWS without granting public-read access, but still be able to view the file using a URL in a protected route on my client side (Reactjs/Nextjs)? How can I make this work?

The situation: I need to send a PDF file from my backend to AWS with restricted public-read access (ACL), while also displaying that PDF using react-pdf within a secure route.

Answer №1

Consider utilizing Amazon S3 pre-signed URLs, which offer temporary access to confidential objects stored in Amazon S3.

Your application can create these URLs locally, eliminating the need for an AWS API request, but it must possess an Access Key and Secret Key with appropriate permissions to retrieve the object.

By using this method, you can keep objects secure while still being able to share a link that allows retrieval. The link automatically expires after a specified time frame.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the steps for creating a standalone build in nextJS?

Currently, I am undertaking a project in which nextJS was chosen as the client-side tool. However, I am interested in deploying the client as static code on another platform. Upon generating a build, a folder with all the proprietary server elements of ne ...

Navbar Username in Next.js with Typescript and Supabase Integration

I'm currently facing an issue with retrieving the username of a user to display in my navbar. The desired username is stored in the "username" column of the table called "profiles" in my Supabase database. However, the data that's populating the ...

Tips for directing a domain to a specific location within NextJS

In my NextJS application, I have two different domains: eldes.com eldes.com.br I am interested in setting up a redirect from eldes.com.br/:path* to eldes.com/br/:path* ...

How does Stripe manage to bypass NextJS CORS restrictions?

I've got a Next.js 13 app with app routes that incorporate Stripe for processing payments. I have set up a route at app/api/webhook/route.ts to handle Stripe webhooks triggered after a client makes a purchase. Everything is working smoothly so far. Ho ...

Enhancing PHP Token Security

I developed a PHP application that has a login requirement. This application is exclusive, so no new users can create accounts. Initially, I implemented sessions to identify users, but it caused issues on tablet devices as they would lose their sessions. I ...

How can I display input only when a checkbox is selected? React with Next.js

I'm trying to figure out how to handle this task, but I'm a bit confused on the approach. I would like to display the promo code field only when the checkbox (I have a promo code) is checked. Additionally, it would be ideal to reveal this field ...

The ID provided does not match the format of a Function Type

Click here for the image import {MongoClient, ObjectId} from "mongodb"; async function handler(req, res){ if(req.method === "POST"){ const data = req.body; const client = await MongoClient.connect("mongoDB URL&q ...

What could be causing the favicon in my Next.js application to not function properly?

My favicon doesn't seem to be working properly. I've saved the favicon file as favicon.ico in the /public directory and have included a reference to it in the <Head> section of my pages (which are located in the /pages directory), but it s ...

Encountering an error when importing fs into a Next.js serverless function

While working in Next.js 14, I encountered an issue when trying to import 'fs' inside a serverless function: import fs from "fs"; import path from 'path'; export async function POST(req: Request) { const promptTemplate = ...

Executing npm build within a prebuild script on Vercel to compile a Next.js application

I am in the process of developing a unique Markdown- / MDX-based platform for blogging (take a look at my project on GitHub). I want to give users the ability to incorporate their own React components into the content section of their MDX files. The Chall ...

Next.js Project Encountering AWS Amplify Authentication Error: "UserPool not configured"

I am currently developing a project using NextJS and integrating AWS Amplify for authentication with Amazon Cognito. However, I am facing an issue where an error message saying "Auth UserPool not configured" pops up when attempting to log in or sign up. I ...

Solution: The issue where the children's onChange event was not updating the parent in Ant Design was discovered to be due to the Select and Table components nested inside a Tab not changing according to the pageSize

I'm facing an issue with updating a parent element when the children's onChange event is triggered. Specifically, I have an Ant Design Select and Table inside a Tab that are not reflecting changes in the pageSize value. Although setPageSize func ...

What is causing ESLint errors not to be displayed in the browser when they occur?

Recently, I noticed that ESLint errors are no longer appearing on the browser screen while I develop my Next.js (v14) app. Despite having several ESLint rules in place, they do not display on the screen like they did when using CRA. I prefer it when the a ...

Having trouble deploying Next.js on Azure due to an error indicating that the function content size was too large

Encountering difficulties when attempting to deploy the Next.js SSR app on Azure static-web-app. I have included the necessary configurations in the yml file to limit caching, but I am still receiving an ERROR: "The size of the function content was too lar ...

I am unable to utilize autocomplete with types that are automatically generated by Prisma

Currently, I am working on a project utilizing Next and Prisma. Within my schema.prisma file, there are various models defined, such as the one shown below: model Barbershop { id String @id @default(uuid()) name String address String ...

Problem with session cookies not being included in cross-origin replies using Express, Redis, and Next.js

I am currently working on a project that involves using an Express.js backend in conjunction with a Next.js frontend. The backend utilizes the Redis and connect-redis packages for session management, while the server is deployed on Heroku with the Heroku-D ...

Encountering the error message "The getStaticPaths function in Next.js requires the 'id' parameter to be provided as a string"

Having an issue with the getStaticPaths function. Every time I attempt to create a dynamic display using a parameter, it gives me an error message: A required parameter (id) was not provided as a string in getStaticPaths for / movies / [id]. However, if ...

Next.js dynamic routes are not functioning properly upon page refresh

I am currently encountering an issue with dynamic routes in Next.js. Within my application, I am utilizing getStaticPaths, getStaticProps, and the following code snippet: <Link href={`/offers/[id]?id=${offer.id}`} as={`/offers/${offer.id}`} > ...

When trying to pass props from a parent to a component in Next.js, the issue of props

Within /pages/profile.js, I am utilizing the LovedOne element by passing values from props. Upon debugging, it is evident that these values are indeed valid when passed. import React from "react"; import LovedOne from "../components/loved_on ...

Is it feasible to utilize Google Calendar API for JavaScript through npm install? Alternatively, can the Google Calendar API be utilized for Node.js in the browser within Next.js?

Looking to integrate the Google Calendar API as a library in your Next.js project without using _document.tsx? I have explored two potential approaches for achieving this: Utilize the google calendar api for JavaScript by installing it via npm Use the goo ...