location ^~ modifier

B.R. reallfqq-nginx at yahoo.fr
Wed Dec 9 19:50:02 UTC 2015


Thanks Francis,

I directly went back to the basics nginx 101 lesson.
I feel dumb all of a sudden...

The maze was made of my misconceptions!
I wonder where they came from. I was sure I tested what I said... which is
impossible.
---
*B. R.*

On Wed, Dec 9, 2015 at 9:47 AM, Francis Daly <francis at daoine.org> wrote:

> On Tue, Dec 08, 2015 at 06:33:52PM +0100, B.R. wrote:
>
> Hi there,
>
> > That means the following is a 'prefix' location block:
> > location /whatever/ {
> > }
> >
> > That said, this block will match the /whatever/ string anywhere in the
> URI
> > string, not only at its start.
>
> No, it won't.
>
> ===
>     location / {
>         return 200 "in location /\n";
>     }
>
>     location /aaa/ {
>         return 200 "in location /aaa/\n";
>     }
> ===
>
> $ curl http://localhost/aaa/bbb/
> in location /aaa/
>
> $ curl http://localhost/bbb/aaa/
> in location /
>
> > As a consequence, to me, the meaning of 'prefix' was not tied to the
> > location of the matched string in the URI, but rather a definition more
> > like 'matching a string in the URI'.
>
> No.
>
> "prefix" has its normal English language meaning. The documentation at
> http://nginx.org/r/location is correct.
>
> (I think the documentation there is *incomplete*, as it is not immediately
> clear to me how nested locations are searched. But that has been clarified
> on the mailing list recently, and that clarification matches what can
> be seen in tests.)
>
> > Where is the exit of the maze again?
>
> prefix matches -- without modifier, with modifier ^~, and (technically,
> probably) with modifier = -- are exact string matches at the start of
> the url. (And consequently should all start with the character "/".)
>
> If you want to match something that is not an exact string match at the
> start of the url, you must use something that is not a prefix match.
>
>         f
> --
> Francis Daly        francis at daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151209/66a979b4/attachment.html>


More information about the nginx mailing list