nginx
config_error
ai_generated
true
Wrong location block matched: regex takes precedence
ID: nginx/regex-location-order
80%Fix Rate
84%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1 | active | — | — | — |
Root Cause
Nginx location matching order causing wrong block to handle request.
genericWorkarounds
-
90% success Use exact match (=) for specific paths, prefix (^~) to skip regex
-
92% success Remember order: exact > prefix(^~) > regex > prefix
Dead Ends
Common approaches that don't work:
-
Use regex for all locations
78% fail
Performance impact, hard to debug
-
Add if statements inside locations
82% fail
nginx if is evil in location context