openresty / echo-nginx-module

An Nginx module for bringing the power of "echo", "sleep", "time" and more to Nginx's config file
http://wiki.nginx.org/NginxHttpEchoModule
BSD 2-Clause "Simplified" License
1.17k stars 255 forks source link

echo_location doesn't return the status code #55

Closed grvsaxena419 closed 8 years ago

grvsaxena419 commented 8 years ago

Hi

If you have a configuration like below

`location /foo { echo_location /bar; }

location /bar { proxy_pass http://some-server }`

Making a call to /foo always returns 200 instead of returning the status code returned by some-server.

agentzh commented 8 years ago

@grvsaxena419 In nginx's design, a subrequest's response status code does not affect its parent request by default. This is understandable since a request can have multiple subrequests and they can carry different status codes. In your example, echo_location initiates a subrequest, whose status code won't affect the main request, by definition.