Answer the question
In order to leave comments, you need to log in
How to regulate access to static files in express?
The site is a school of online courses. There are several courses, inside which there are mp4 and pdf files. The files are located in the files folder. I gave them access via express.static():
But I'm worried that a person who does not have access to subscription B will be able to open pdf and audio files through the address bar. Is there any way to check if a person has access to a subscription, and thus secure the files?
app.use('/files', express.static('files'))
Answer the question
In order to leave comments, you need to log in
It is better to /files/:filename
hang up on the handler and check the subscription there. And already give a file or a 403 error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question