misunderstood regex location

dcaillibaud nginx-forum at nginx.us
Tue May 6 18:39:18 UTC 2014


> > 2) (I guess E but I'm not so sure), this can also be a pitfall
> example (how
> > complicating things can lead to unexpected behaviour)
> >
> > location /images/ {
> >     location ~* \.(gif|jpg|jpeg)$ {
> >       [ configuration D ]
> >     }
> > }
> >
> > location ~* \.(gif|jpg|jpeg)$ {
> >     [ configuration E ]
> > }


> The request processing stops on the first matching regex.

Which is ?

I guess E, but I'm not sure since the doc doesn't say if the inner regex is
read before or after the next 1st level one. I understand that all first
level are evaluated to see if one branch need to be explored deeper, but
it's not so obvious. 

Anyway, this example is more a school case, it should be avoid in real life,
so answer is not so important. If I need to answer such a question then I'm
probably in the wrong way.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,249846,249873#msg-249873



More information about the nginx mailing list