nginx-0.7.18

Igor Sysoev is at rambler-co.ru
Tue Oct 21 17:04:06 MSD 2008


On Tue, Oct 21, 2008 at 08:58:57PM +0800, lhmwzy wrote:

> OK.
> The dir structure is:
> wwwroot/dll/dl/index.html
> 
> the www root is wwwroot.
> I put the following to nginx.conf
> 
> server {
> 
>   .............
>         location /dll/
>         {
>             secure_link_secret  some;
> 
>              if ($secure_link = "") {
>                  return 500;
>            }
>         }
> 
> ..........
> }
> 
> Then I request through
> http://host/dll/cb691d768d21d59719ef7ed3b2ecaf4e/dl
> Also get a 500 error page.
> 
> md5(somedl)=cb691d768d21d59719ef7ed3b2ecaf4e

Have you tried the attached patch ?

BTW, /dll/3373757a24a035b9d157d97468401a19/dl/index.html
should work without patch.

> 2008/10/21 Igor Sysoev <is at rambler-co.ru>:
> > On Wed, Oct 15, 2008 at 09:21:55PM +0800, lhmwzy wrote:
> >
> >> Still can not configure "ngx_http_secure_link_module" successfully...
> >
> > The module did not work if link was less than 3 symbols ("dl").
> > The attached patch should fix the bug.
> >
> >> 2008/10/15 lhmwzy <lhmwzy at gmail.com>:
> >> > Any body try "ngx_http_secure_link_module" and successful?
> >> > Please give me a hint.
> >> >
> >> > 2008/10/14 lhmwzy <lhmwzy at gmail.com>:
> >> >> I think the $secure_link is not right.
> >> >> when change
> >> >>
> >> >>                if ($secure_link = "") {
> >> >>                              return 403;
> >> >>               }
> >> >>
> >> >> to
> >> >>
> >> >>
> >> >>                if ($secure_link = "") {
> >> >>                              return 500;
> >> >>               }
> >> >> then the error is always 500 error.
> >> >> Thus we can say the $secure_link=""?
> >> >>
> >> >> 2008/10/14 lhmwzy <lhmwzy at gmail.com>:
> >> >>> Yes,I put a index.html file in dl directory.
> >> >>>
> >> >>> 2008/10/14 Igor Sysoev <is at rambler-co.ru>:
> >> >>>> On Tue, Oct 14, 2008 at 05:13:31PM +0800, lhmwzy wrote:
> >> >>>>
> >> >>>>> 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?
> >> >>>>
> >> >>>> Do you have index file in /dll/dl/ ? Or autoindex enabled ?
> >> >>>>
> >> >>>>> 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
> >> >>>>> >
> >> >>>>> >
> >> >>>>
> >> >>>> --
> >> >>>> Igor Sysoev
> >> >>>> http://sysoev.ru/en/
> >> >>>>
> >> >>>>
> >> >>>
> >> >>
> >> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list