diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2005-10-05 14:46:21 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2005-10-05 14:46:21 +0000 |
| commit | a257367813cc604e9a8012cb64936a96b3a169cc (patch) | |
| tree | f85d61c240f4d0ec775e6fb68709a902b9137111 /src/http/ngx_http_special_response.c | |
| parent | c6806be34feef0bb4a9611338ed3a0b6f886111c (diff) | |
| download | nginx-a257367813cc604e9a8012cb64936a96b3a169cc.tar.gz nginx-a257367813cc604e9a8012cb64936a96b3a169cc.tar.bz2 | |
nginx-0.2.6-RELEASE importrelease-0.2.6
*) Change: while using load-balancing the time before the failed
backend retry was decreased from 60 to 10 seconds.
*) Change: the "proxy_pass_unparsed_uri" was canceled, the original URI
now passed, if the URI part is omitted in "proxy_pass" directive.
*) Feature: the "error_page" directive supports redirects and allows
more flexible to change an error code.
*) Change: the charset in the "Content-Type" header line now is ignored
in proxied subrequests.
*) Bugfix: if the URI was changed in the "if" block and request did not
found new configuration, then the ngx_http_rewrite_module rules ran
again.
*) Bugfix: if the "set" directive set the ngx_http_geo_module variable
in some configuration part, the this variable was not available in
other configuration parts and the "using uninitialized variable"
error was occurred; the bug had appeared in 0.2.2.
Diffstat (limited to 'src/http/ngx_http_special_response.c')
| -rw-r--r-- | src/http/ngx_http_special_response.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index be23d6d5b..5a1f3c461 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -283,18 +283,31 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) for (i = 0; i < clcf->error_pages->nelts; i++) { if (err_page[i].status == error) { + r->err_status = err_page[i].overwrite; + r->err_ctx = r->ctx; - if (err_page[i].overwrite) { - r->err_status = err_page[i].overwrite; - } else { - r->err_status = error; + r->method = NGX_HTTP_GET; + + if (err_page[i].uri.data[0] == '/') { + return ngx_http_internal_redirect(r, &err_page[i].uri, + NULL); } - r->err_ctx = r->ctx; + r->headers_out.location = + ngx_list_push(&r->headers_out.headers); - r->method = NGX_HTTP_GET; + if (r->headers_out.location) { + r->err_status = NGX_HTTP_MOVED_TEMPORARILY; + error = NGX_HTTP_MOVED_TEMPORARILY; + + r->headers_out.location->hash = 1; + r->headers_out.location->key.len = sizeof("Location") - 1; + r->headers_out.location->key.data = (u_char *) "Location"; + r->headers_out.location->value = err_page[i].uri; - return ngx_http_internal_redirect(r, &err_page[i].uri, NULL); + } else { + error = NGX_HTTP_INTERNAL_SERVER_ERROR; + } } } } |
