c++ - Use Web Service In Nginx configuration File -
see configuration
location ~* ^/dl/([a-za-z0-9\-\_]+)/([0-9]+)(.*)$ { root /home/godofwar/public_html/; secure_link $1,$2; secure_link_md5 oh4fj4kion6srt5txdc1$3$2; if ($secure_link = "") { return 403; } if ($secure_link = "0") { return 403; } rewrite ^/dl/([a-za-z0-9\-\_]+)/([0-9]+)/(.*)$ /$3 break; }
after token , expiry time checked (before rewrite), want call module operation token , user ip sent web service; if output of web service true, file downloaded, , if false, username/password received , sent web service in http auth basic. if output of web service true, file downloaded, , if false, error 404 given
for example :
http://www.example.com/dl/gghbgdpqluckx17nbby29w/1440849227/user/john/files/video.mp4
/* * after token , expiry time checked * token , user ip sent web service : * ws : http://www.example.com/checktoken/gghbgdpqluckx17nbby29w/52.152.62.145 */ if(true) { rewrite ^/dl/([a-za-z0-9\-\_]+)/([0-9]+)/(.*)$ /$3 break; } else { /* * username/password received , sent web service similar http auth module. * ws : http://www.example.com/checkuser/godofwar/123456 */ if(true) { rewrite ^/dl/([a-za-z0-9\-\_]+)/([0-9]+)/(.*)$ /$3 break; } else { return 404; } }
please me solve problem
Comments
Post a Comment