diff options
author | Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp> | 2014-11-04 19:56:23 +0900 |
---|---|---|
committer | Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp> | 2014-11-04 19:56:23 +0900 |
commit | d9f5baa0b8e45beae8c76b31318d5ae9dbf013da (patch) | |
tree | 4f50d235f68f2e9eb7e4faa2693bf41da77bc7c3 /src | |
parent | a9d9b09103dcb7a5fd21b8daa962afc1c9fc526b (diff) | |
download | nginx-d9f5baa0b8e45beae8c76b31318d5ae9dbf013da.tar.gz nginx-d9f5baa0b8e45beae8c76b31318d5ae9dbf013da.zip |
Upstream: support named location for X-Accel-Redirect.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_upstream.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 3e8ce09e1..f343d0463 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2218,19 +2218,26 @@ ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u) } uri = u->headers_in.x_accel_redirect->value; - ngx_str_null(&args); - flags = NGX_HTTP_LOG_UNSAFE; - if (ngx_http_parse_unsafe_uri(r, &uri, &args, &flags) != NGX_OK) { - ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); - return NGX_DONE; - } + if (uri.data[0] == '@') { + ngx_http_named_location(r, &uri); + + } else { + ngx_str_null(&args); + flags = NGX_HTTP_LOG_UNSAFE; + + if (ngx_http_parse_unsafe_uri(r, &uri, &args, &flags) != NGX_OK) { + ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); + return NGX_DONE; + } + + if (r->method != NGX_HTTP_HEAD) { + r->method = NGX_HTTP_GET; + } - if (r->method != NGX_HTTP_HEAD) { - r->method = NGX_HTTP_GET; + ngx_http_internal_redirect(r, &uri, &args); } - ngx_http_internal_redirect(r, &uri, &args); ngx_http_finalize_request(r, NGX_DONE); return NGX_DONE; } |