I suppose libpcre3 implements all of PCRE, including non-capturing
groups. Is this a limitation of nginx regex handling? Or I’m I
misundertanding something more fundamental in what nginx conditionals
and regex handling is concerned?
This one will always return 404 (with s/adrr/addr/ typo fix).
Probably you mean to add “break” inside “if”.
But this isn’t recommended aproach, see here for details:
Travelling down the somewhat dubious path of security by obscurity I
find that returning 404 revals less than a 403.
If you want to return 404 instead of 403 - just use access module
and configure error_page 403 =404 instead. See
for details.
But I’m aware that it’s a pretty scant justification for using a
conditional. In terms of efficiency which approach is preferred?
Using access module is much better idea from all points of view.
I suppose libpcre3 implements all of PCRE, including non-capturing
groups. Is this a limitation of nginx regex handling? Or I’m I
misundertanding something more fundamental in what nginx conditionals
and regex handling is concerned?
Non-capturing groups work just fine. It’s missed “break” which
causes 404, see above.
I tried two approaches and both seem to work
This one will always return 403 due to “deny all” directive listed
first. Order of deny/allow directives is important, first match
wins.
It was working because I had created a new git branch and forgot to do
the checkout in the cloned repository in /etc/nginx. My mistake
I assumed that nginx would work like Apache minus the order deny,allow
directive. My reasoning was that first I denied access and then nginx
would parse the remaining directives to see if there are any allowed
addresses.
But I’m conditioned by the way Apache access directives work and
assumed it was +/- less the same minus the order directive.
I misunderstood the docs in the wiki. I just edited it trying to make
things more explicit. Lowering the probabilty for this type of mistake
to occur to someone else.
Probably you mean to add “break” inside “if”.
Yes it’s a typo. I just wrote instead of cutting & pasting.
But this isn’t recommended aproach, see here for details:
Non-capturing groups work just fine. It’s missed “break” which
causes 404, see above.
Yes I have it in other lcations and it’s working fine. It was the
missing break. Anyway I dropped the if and followed your suggestion of
employing access rules.
Maxim D.
— appa
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.