search

Home  >  Q&A  >  body text

In nginx, proxy_pass and rewrite execution order

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

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 17:14:02

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

    reply
    0
  • Cancelreply