Having an nginx location prefix section where the rewrite rule regex starts with the location itself, is there a difference between having the regex with or without the caret (^)? Doesn't seem so, since it will return the first match, but maybe a counterexample exists?
For example, location with ^:
location /smth/ {
rewrite ^/smth(.*)$ /somewhere/else$1 break;
}
And without:
location /smth/ {
rewrite /smth(.*)$ /somewhere/else$1 break;
}
Seem functionally equivalent.