Location Matches
type
status
date
slug
summary
tags
category
icon
password
Prefix matching
/agatha
/agatha-christie
The responses after the requests are all the same.Because the configuration
location/agatha
matches URIs that start with agatha
.Exact match
Configuring
location = /agatha
will result in an exact match.Regular expression matching
Configuring
location ~ /agatha[0-9]
is case-sensitive by default.Configuring
location ~* /agatha[0-9]
is case-insensitive.Priority
NGINX assigns priority values to these matches, and a regex match has more priority than a prefix match.
If you want to match according to the configuration order
location/Agatha7
location ~* /agatha[0-9]
You need to use
^~
This time, the prefix match wins.
So the list of all the matches in descending order of priority is as follows:
Match | Modifier |
Exact | = |
Preferential Prefix | ^~ |
REGEX | ~ or ~* |
Prefix | None |
Reference article
Loading...
Last update: 2024-08-22