How can I get all the files on the server with cookies to access the download?

Source: Internet
Author: User
May I ask you the great God, how to make the file on the server must be in the URL containing cookies to download?
In particular, PHP redirects to a real file (php method I tried, but not enough to meet the needs of the need is even PHP access to carry cookies, and then redirected to the real file, also need to bring a cookie to download the real file)

Like this, for example:
Http://gdl.lixian.vip.xunlei.com/download?fid=0hR2BkWuxG+yu8/SSvHED9qPY3qIM6UBAAAAAPgVMM+tcuZfzsSdkpa5AVaDBXss &mid=666&threshold=150&tid=2d7127d9ac515342bbcf3c2534a28b6e&srcid=4&verno=1&g= F81530cfad72e65fcec49d9296b9015683057b2c&scn=t13&i=f81530cfad72e65fcec49d9296b9015683057b2c&t=1 &ui=352085248&ti=749121079740928&s=27603848&m=0&n= 01397cb40c657475702d58903a2d786c384f549c3a00000000&ff=0&co=7146348578e47321f9adcdc2e65e5373&cm=1 &pk=lixian&ak=1:1:6:4&e=2000000000&ms=10485760&ck=7d925ecc1c9c2cd1098d37bae3d249e3&at= bfbb6ae6fdc257d3bc3a9fdbfae45212
After authentication via cookies, redirect to:
http://vod39.t6.lixian.vip.xunlei.com:443/download?fid=vlMMl5rBhEpw40dAJIWIAzFss/IbL0I1AAAAAGp5LQx3uSW+ vwah1lgogjx68tey&mid=666&threshold=150&tid=7a76d65fcfbedd0710723b8e9472cf47&srcid=4&verno= 1&g=6a792d0c77b925be5566a1d4b18e189c7af137b2&scn=t6&i=d4fdf4149cf91ca34fc1a528291ba4d4&t=4 &ui=346853248&ti=767920006498817&s=893529883&m=0&n= 01226220f8d6e42e482500d46d34b8dfc784e7348ca2cbabd7b71f892f34000000&ff=0&co= 907fcd65b217061ff4d04bdebfbd25d5&cm=1&pk=lixian&ak=1:0:2:3&e=2000000000&ms=10485760&ck =3c1c62b8c80d6c0c47c833d5a92def1d&at=d9ad4f55bc8c22c248a75e6e2459686e&k=1&ts=1410592408
It is still necessary to bring cookies to download this file.
(The second URL does not seem to be PHP, because the real address of the downloaded file is this, no more jumps and redirects)
(URL is just an example, not accessible)

How does that happen?

Server is Nginx/linux

Reply content:

May I ask you the great God, how to make the file on the server must be in the URL containing cookies to download?
In particular, PHP redirects to a real file (php method I tried, but not enough to meet the needs of the need is even PHP access to carry cookies, and then redirected to the real file, also need to bring a cookie to download the real file)

Like this, for example:
Http://gdl.lixian.vip.xunlei.com/download?fid=0hR2BkWuxG+yu8/SSvHED9qPY3qIM6UBAAAAAPgVMM+tcuZfzsSdkpa5AVaDBXss &mid=666&threshold=150&tid=2d7127d9ac515342bbcf3c2534a28b6e&srcid=4&verno=1&g= F81530cfad72e65fcec49d9296b9015683057b2c&scn=t13&i=f81530cfad72e65fcec49d9296b9015683057b2c&t=1 &ui=352085248&ti=749121079740928&s=27603848&m=0&n= 01397cb40c657475702d58903a2d786c384f549c3a00000000&ff=0&co=7146348578e47321f9adcdc2e65e5373&cm=1 &pk=lixian&ak=1:1:6:4&e=2000000000&ms=10485760&ck=7d925ecc1c9c2cd1098d37bae3d249e3&at= bfbb6ae6fdc257d3bc3a9fdbfae45212
After authentication via cookies, redirect to:
http://vod39.t6.lixian.vip.xunlei.com:443/download?fid=vlMMl5rBhEpw40dAJIWIAzFss/IbL0I1AAAAAGp5LQx3uSW+ vwah1lgogjx68tey&mid=666&threshold=150&tid=7a76d65fcfbedd0710723b8e9472cf47&srcid=4&verno= 1&g=6a792d0c77b925be5566a1d4b18e189c7af137b2&scn=t6&i=d4fdf4149cf91ca34fc1a528291ba4d4&t=4 &ui=346853248&ti=767920006498817&s=893529883&m=0&n= 01226220f8d6e42e482500d46d34b8dfc784e7348ca2cbabd7b71f892f34000000&ff=0&co= 907fcd65b217061ff4d04bdebfbd25d5&cm=1&pk=lixian&ak=1:0:2:3&e=2000000000&ms=10485760&ck =3c1c62b8c80d6c0c47c833d5a92def1d&at=d9ad4f55bc8c22c248a75e6e2459686e&k=1&ts=1410592408
It is still necessary to bring cookies to download this file.
(The second URL does not seem to be PHP, because the real address of the downloaded file is this, no more jumps and redirects)
(URL is just an example, not accessible)

How does that happen?

Server is Nginx/linux

The second one might be PHP,

The implementation is validated,

PHP verification, after the verification of PHP output file content, validation does not pass the output error message or output something.

Don't jump again. After verifying the cookie is valid, return the file directly

It is unlikely that application server rules will be implemented to control, generally PHP verification after jumping to the real address.

Using interceptors to verify the first

I used to have someone write an nginx extension with C.
It's now easy to implement with Lua.

Nginx can implement X-sendfile, the download directory is set to internal can be

Http://wiki.nginx.org/XSendfile
http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.