Enforcing authentication requests for all resources under specific path

Jan Wrobel wrr at mixedbit.org
Thu Mar 29 20:53:22 UTC 2012


On Thu, Mar 29, 2012 at 10:29 PM, Francis Daly <francis at daoine.org> wrote:
> On Thu, Mar 29, 2012 at 07:21:05PM +0200, Jan Wrobel wrote:
>
> Hi there,
>
>> In my case this is not too good option. I need authentication layer
>> configuration to be independent from applications configuration. In
>
> Because of the way nginx configuration works, they can't be completely
> independent.
>
> But you could try nesting locations:
>
> location /protected/ {
>  auth_request etc...
>
>  location /protected/blog {
>    blog config...
>  }
>
>  location ~ png {
>    png config...
>  }
>
> }
>
> (And of course you'll want no top-level regex locations; but that's good
> practice anyway.)
>
> Quick testing suggests that the auth request module does inherit these
> configurations.

Thanks, this works!

Jan



More information about the nginx mailing list