Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#1649 closed enhancement (worksforme)

Improve documentation for the location block

Reported by: ovidiu.b13@… Owned by:
Priority: minor Milestone:
Component: documentation Version:
Keywords: Cc:
uname -a: N/A
nginx -V: N/A

Description

The documentation for the location block does not clearly state the order in which matching is done for non-prefixed locations.

e.g.

location / {...}
location /foo {...}

If I go to "/foo", are all the location blocks checked, and the longest match selected? Or is the written order taken into consideration?

The documentation currently only talks about prefixed locations or regular expressions, and provides no clarification for non-prefixed locations.

Change History (2)

comment:1 by Sergey Kandaurov, 6 years ago

Resolution: worksforme
Status: newclosed

There are no "non-prefixed" locations. Please consult with the documentation.
Here are some snippets for your convenience:

A location can either be defined by a prefix string, or by a regular expression.

To find location matching a given request, nginx first checks locations defined
using the prefix strings (prefix locations). Among them, the location with the
longest matching prefix is selected and remembered.

In general, a better place to ask user questions about nginx is the nginx@ mailing list.

comment:2 by ovidiu.b13@…, 6 years ago

I assumed that "prefix" means

[ = | ~ | ~* | ^~ ]

And by non-prefixed I meant if I don't use any of those.

If I understand you correctly, I need to read from somewhere: what's the definition of a prefixed string?

Is it defined somewhere else? if not, this term should be clarified.

Last edited 6 years ago by ovidiu.b13@… (previous) (diff)
Note: See TracTickets for help on using tickets.