nginx-0.7.18

lhmwzy lhmwzy at gmail.com
Tue Oct 14 13:13:31 MSD 2008


OK.
Here is my config:
.........
  location /dll/
        {
          secure_link_secret  lhm;
               if ($secure_link = "") {
                             return 403;
              }
           rewrite ^ /$secure_link  break;
        }
............

Then request a directory under dll
/dll/dl/

md5(dllhm)=91fe55efd557140f7a32f7f7c1c74aa3

use "http://host/dll/91fe55efd557140f7a32f7f7c1c74aa3/dl" to request,right?

Then get "403 Forbidden"

Any thing is wrong?

2008/10/14 Igor Sysoev <is at rambler-co.ru>:
> On Tue, Oct 14, 2008 at 12:57:36PM +0400, Igor Sysoev wrote:
>
>> On Tue, Oct 14, 2008 at 04:40:29PM +0800, lhmwzy wrote:
>>
>> > Still not ok.........
>> > I am confused.......
>
> -    rewrite  ^   $secure_link   break;
> +    rewrite  ^   /$secure_link  break;
>
>> What do you get 404 or 403 ?
>> If the former,  what in your error_log ?
>>
>> > 2008/10/14 Igor Sysoev <is at rambler-co.ru>:
>> > > On Tue, Oct 14, 2008 at 04:10:58PM +0800, lhmwzy wrote:
>> > >
>> > >> Also not right.
>> > >> I can not get the right thing.
>> > >> Can you give me an example?
>> > >
>> > > You also need a "rewrite" to replace an URL with a link itself only:
>> > >
>> > >   location /dl/
>> > >        secure_link_secret  lhm;
>> > >        if ($secure_link = "") {
>> > >            return 403;
>> > >        }
>> > >     }
>> > >
>> > >     root  /path/to/files;
>> > >
>> > >     rewrite  ^   $secure_link  break;
>> > >  }
>> > >
>> > >
>> > >> 2008/10/14 Anton Yuzhaninov <citrin at citrin.ru>:
>> > >> > On 14.10.2008 08:53, lhmwzy wrote:
>> > >> >>
>> > >> >> I have set a secure link:
>> > >> >>  location /dl/
>> > >> >>        {
>> > >> >>         secure_link_secret  lhm;
>> > >> >>            if ($secure_link == "") {
>> > >> >>                        return 503;
>> > >> >>             }
>> > >> >>        }
>> > >> >>
>> > >> >>
>> > >> >> Then
>> > >> >> md5(dllhm)=91fe55efd557140f7a32f7f7c1c74aa3
>> > >> >>
>> > >> >> Then access it through
>> > >> >> http://host/91fe55efd557140f7a32f7f7c1c74aa3/dl/,but get a 404.
>> > >> >>
>> > >> >
>> > >> > URL should be under location /d1/ e. g.
>> > >> >
>> > >> > http://host/d1/7a701b100383d50fc2995ed264add62a/some_url_to_protected_resource
>> > >> >
>> > >> > $ echo -n some_url_to_protected_resourcelhm | md5
>> > >> > 7a701b100383d50fc2995ed264add62a
>> > >> >
>> > >> > --
>> > >> >  Anton Yuzhaninov
>> > >> >
>> > >> >
>> > >
>> > > --
>> > > Igor Sysoev
>> > > http://sysoev.ru/en/
>> > >
>> > >
>>
>> --
>> Игорь Сысоев
>> http://sysoev.ru
>
> --
> Игорь Сысоев
> http://sysoev.ru
>
>


More information about the nginx mailing list