5.2.5 rewrite_redirect回调方法

在重定向URL阶段,如果实现了rewrite_redirect回调方法,那么这时会调用rewrite_redirect。注意,本章不涉及rewrite_redirect方法,感兴趣的读者可以查看upstream模块的ngx_http_upstream_rewrite_location方法。如果upstream模块接收到完整的上游响应头部,而且由HTTP模块的process_header回调方法将解析出的对应于Location的头部设置到了ngx_http_upstream_t中的headers_in成员时,ngx_http_upstream_process_headers方法将会最终调用rewrite_redirect方法(见12.5.3节图12-5的第8步)。因此,rewrite_redirect的使用场景比较少,它主要应用于HTTP反向代理模块(ngx_http_proxy_module)。