But requests to /app/secure/login are handled by http://backend. What is the problem?
medium
A. The regex location syntax is incorrect and ignored.
B. The proxy_pass directive is missing a trailing slash.
C. The ^~ prefix match prevents regex location from being used.
D. nginx does not support mixing ^~ and regex locations.
Solution
Step 1: Understand nginx location matching with ^~
The ^~ prefix tells nginx to prefer this prefix match and skip regex checks if matched.
Step 2: Analyze why regex location is ignored
Since /app/secure/login matches ^~ /app/, nginx stops searching and uses that block, ignoring the regex location.
Final Answer:
The ^~ prefix match prevents regex location from being used. -> Option C
Quick Check:
^~ stops regex location checks [OK]
Hint: ^~ disables regex locations if prefix matches [OK]
Common Mistakes:
Thinking regex overrides ^~ prefix
Believing proxy_pass syntax causes this issue
Assuming nginx can't mix ^~ and regex locations
5. You want nginx to serve static files from /var/www/static for URLs starting with /static/, and use regex locations for other patterns. Which config correctly uses ^~ to optimize performance?