Next.js and File Downloads: Three Ways to Restrict Access to a Fileby@sashe
8,659 reads

Next.js and File Downloads: Three Ways to Restrict Access to a File

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Files offered for download to subscribers or customers should not be put in the public folder of Next.js because they will be freely accessible. There are three feasible ways to protect a file, and which one you choose depends on the level of acceptable risk and how valuable the file is. The core idea is to use an API endpoint that checks the user’s credentials and serves the protected file if everything is OK.

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Next.js and File Downloads: Three Ways to Restrict Access to a File
Sashe HackerNoon profile picture

@sashe

Sashe


Receive Stories from @sashe


Credibility

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa