First question: The following is a location in nginx.conf.
The fifth line executes rewrite, so are lines 6 and 7 necessarily not executed?
So why did the original author write location like this?
Second question, at which stage of nginx's 11 request processing are proxy_pass and rewrite executed?
1 location ~ "(.*)$" {
2 set $vhost "-cba";
3 set $vpath "2";
4 set $cookie_path "/";
5 rewrite .* $vpath break;
6 proxy_pass http://$vhost;
7 proxy_cookie_path / $cookie_path;
}
break no longer performs rewrite of the same block. But other instructions are still executed.
You can refer to this article