J
J
jenya77712018-03-01 22:08:32
Node.js
jenya7771, 2018-03-01 22:08:32

How to generate a one-time link available to a specific user?

Hello, how can I generate a one-time link to a video that is available to a specific user, and where can I place this video on the server so that it is not available via a direct link?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2018-03-02
@jenya7771

1. we generate a sequence crypto-randomly , divide it into 2 parts, write one of the parts to cookies, the other to the generated url (naturally we distill it in base64 or hex)
2. save the path to the desired file in redis, use the full sequence generated earlier as a key , set expire - how long the link should live
3. implement resume support on our server (google ranged http response), without it, the vidos will not work at least in safari, and will slow down in others
4. upon request, check cookies on our link, check radish, give the file (requested part), use stream for reading , with 206 response with start and end options, redirect to http response

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question