Access restriction only for people outside LAN

Igor Sysoev is at rambler-co.ru
Mon Sep 28 14:07:28 MSD 2009


On Mon, Sep 28, 2009 at 11:58:21AM +0200, Tomasz Pajor wrote:

> You could try something like this.
> 
> geo $need_auth {
>     default 1;
>     192.168.1.0/24 0;
> }
> 
> server {
>     ...
>     location / {
>         if ($need_auth) {
>             <auth>
>         }
>     }
> }

"satisfy  any" is better;

> > Hi all,
> >
> > I have a service which should be protected using Basic Authentication,
> > but this authentication should be enabled only for people who connect
> > to my service from "the outside of my LAN". Other people (inside LAN)
> > should not have any authentication.
> >
> > Is this possible? How to do that? I couldn't figure out how to use
> > combination of allow/deny with basic authentication for certain
> > location (maybe this is wrong way...).
> >
> > Cheers,
> > Kamil
> >
> >   
> 

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





More information about the nginx mailing list