S
S
Savely2019-10-21 13:24:02
Information Security
Savely, 2019-10-21 13:24:02

How to restrict access to a file by a direct link?

Firework!
Flask has a site site.ru , and there is a static folder, it contains img/ userid in which there are already user pictures.
So, if you know the userid, and the name of the picture, then you can even see it for an unauthorized user at site.ru/img/userid/img.jpg ,
as well as with any other files in other folders in static.
I have two solutions, but they are some kind of crutches:

1)добавить между img и userid , какую нибудь папку типа "09410fd6-e764-4c6a-a9e1"
2)отдавать браузеру картинку в base64, но это не решить проблему с файлами

UPD
Images are needed to display in the .html template, BUT only to certain authorized users who have userid == userid(directories) .
Is there a normal way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentine, 2019-10-21
@vvpoloskin

http_basic_auth or ssl auth
or X-Accell

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question