Opened 5 years ago

Closed 5 years ago

Last modified 5 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, 5 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@…, 5 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.

Version 0, edited 5 years ago by ovidiu.b13@… (next)
Note: See TracTickets for help on using tickets.