Re: Location regex + if + basic auth to restrict directory access

2013-03-10 Thread B.R.
Hello, Thanks for that... I thought the ^~ was meaning 'starting with regex'... My bad! I changed the symbol for some of the ones relly meaning 'regex' (~*) and it works! :o) If there is no better way than sticking with 'if', then it's all good. Thanks again, problem solved, --- *B. R.* On S

Re: Location regex + if + basic auth to restrict directory access

2013-03-10 Thread Francis Daly
On Sun, Mar 10, 2013 at 05:29:18AM -0400, B.R. wrote: Hi there, > The *correct* way: > location ^~ /documents/(\w+) { > set $user $1; > if ($user != $remote_user) { > return 503; > } > } > > Although the syntax is now OK and the configuration is able to be reloaded, > it doe

Re: Location regex + if + basic auth to restrict directory access

2013-03-10 Thread B.R.
I'll answer to my own question there: Apparently, yes, evaluating something with the 'if' directive doesn't propagate the environment containing the variables from the 'location' directive. All explained on StackOverflow

Location regex + if + basic auth to restrict directory access

2013-02-28 Thread B.R.
Hello, I am using basic auth + $remote_user variable send to the back-end application to change context depending on the logged-in user. The thing is, even if the page rendered by the back-end uses nginx user authentication, resources from a directory are still allowed for everyone. My 'document