考虑nginx设置:
server {
server_name abc.com;
listen 80;
location @namedlocation {
proxy_pass google.com;
}
location ~ /some/url {
rewrite /some/url /another/url break;
error_page 418 = @namedlocation;
return 418;
}
}
如果我要求abc.com/some/url,则proxy_pass到google.com/another/url不起作用。但是如果我使用try_files指令
server {
server_name abc.com;
listen 80;
location @namedlocation {
proxy_pass google.com;
}
location ~ /some/url {
rewrite /some/url /another/url break;
try_files /NotImportantPath/ @namedlocation;
}
}
确实如此。能否解释一下这种行为的原因是什么?
闭