My company are building small video CDN with core components: - Request router ( control which edge server will serve the video content ,generate URI for client request to edge server , with token ) - origin video server - edge server (using nginx) My sample URI : http://($remote_address)/videos/($token)/($expires)/abc/xyz/bla/bla/bla/bla/bla/index.mpd token is md5 of secret key , expires... (not remote address) Because some case remote_address from client to request router is not the same as remote_address from client to edge server so i can not limit acces by this ip use nginx secure_link module. Do you guys know how to limit one Uri to the first ip address request it?
Asked
Active
Viewed 279 times
1 Answers
0
I don't think this is doable with Nginx directly.
You basically want to pair the url matching that pattern with the first IP which has access to it.
In order to do that, you need a sort of middleware which is executed on each request to your server.
You could create a script o an simple application which stores pairs of tokens and IPs and checks if the storage contains already a pair with the token.
Once you have that you can run your script on each request through the HttpLuaModule. Check this answer for an example.

xyzale
- 745
- 8
- 14