Process Flow - Preferential prefix match (^~)
Request URL arrives
Check for exact match
Check for ^~ prefix matches
If ^~ prefix match found
Use this location block
If no ^~ prefix match
Check regex locations
Use best matching location
Nginx checks if the request URL matches any location with ^~ prefix first. If yes, it uses that location immediately, skipping regex checks.