In nginx, proxy_pass and rewrite execution order
我想大声告诉你
我想大声告诉你 2017-05-16 17:12:02
0
1
723

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;
    }
我想大声告诉你
我想大声告诉你

reply all(1)
Peter_Zhu

break no longer performs rewrite of the same block. But other instructions are still executed.
You can refer to this article

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template