Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2018-09-21 15:59:33 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2018-09-21 15:59:33 +0300
commita834b8aa09205922bf11c005b3c737b267be12bb (patch)
tree4205debd901488e6ddb4e349506a2c4fec74841a /src/http
parente4a3211e2f651c6f25466ba8a8337ea1aa020c53 (diff)
Rewrite: removed r->err_status special handling (ticket #1634).
Trying to look into r->err_status in the "return" directive makes it behave differently than real errors generated in other parts of the code, and is an endless source of various problems. This behaviour was introduced in 726:7b71936d5299 (0.4.4) with the comment "fix: "return" always overrode "error_page" response code". It is not clear if there were any real cases this was expected to fix, but there are several cases which are broken due to this change, some previously fixed (4147:7f64de1cc2c0). In ticket #1634, the problem is that when r->err_status is set to a non-special status code, it is not possible to return a response by simply returning r->err_status. If this is the case, the only option is to return script's e->status instead. An example configuration: location / { error_page 404 =200 /err502; return 404; } location = /err502 { return 502; } After the change, such a configuration will properly return standard 502 error, much like it happens when a 502 error is generated by proxy_pass. This also fixes the following configuration to properly close connection as clearly requested by "return 444": location / { error_page 404 /close; return 404; } location = /close { return 444; } Previously, this required "error_page 404 = /close;" to work as intended.
Diffstat (limited to 'src/http')
-rw-r--r--src/http/modules/ngx_http_rewrite_module.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c
index a6f1fc820..3b49c455c 100644
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -180,15 +180,7 @@ ngx_http_rewrite_handler(ngx_http_request_t *r)
code(e);
}
- if (e->status < NGX_HTTP_BAD_REQUEST) {
- return e->status;
- }
-
- if (r->err_status == 0) {
- return e->status;
- }
-
- return r->err_status;
+ return e->status;
}