[PATCH 3 of 6] Upstream: unbreak intercept_404 used by memcached
Maxim Dounin
mdounin at mdounin.ru
Mon Oct 27 17:53:23 MSK 2008
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1223802906 -14400
# Node ID 83ba5ad4985f08c8acbffe694fa365a2dff571bf
# Parent 2a993b1413bab4435a9dfe88bd0889d74b90c3da
Upstream: unbreak intercept_404 used by memcached.
We should honor intercept_404 even if no not_found specified in
memcached_next_upstream directive.
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1376,11 +1376,6 @@ ngx_http_upstream_test_next(ngx_http_req
return NGX_OK;
}
- if (status == NGX_HTTP_NOT_FOUND && u->conf->intercept_404) {
- ngx_http_upstream_finalize_request(r, u, NGX_HTTP_NOT_FOUND);
- return NGX_OK;
- }
-
#if (NGX_HTTP_CACHE)
if (u->peer.tries == 0 && u->stale && (u->conf->use_stale & un->mask)) {
@@ -1406,6 +1401,13 @@ ngx_http_upstream_intercept_errors(ngx_h
ngx_http_err_page_t *err_page;
ngx_http_core_loc_conf_t *clcf;
+ status = u->headers_in.status_n;
+
+ if (status == NGX_HTTP_NOT_FOUND && u->conf->intercept_404) {
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_NOT_FOUND);
+ return NGX_OK;
+ }
+
if (!u->conf->intercept_errors) {
return NGX_DECLINED;
}
@@ -1415,8 +1417,6 @@ ngx_http_upstream_intercept_errors(ngx_h
if (clcf->error_pages == NULL) {
return NGX_DECLINED;
}
-
- status = u->headers_in.status_n;
err_page = clcf->error_pages->elts;
for (i = 0; i < clcf->error_pages->nelts; i++) {
More information about the nginx
mailing list