Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: support named location for X-Accel-Redirect.

Maxim Dounin
November 11, 2014 09:04AM
details: http://hg.nginx.org/nginx/rev/7d7eac6e31df
branches:
changeset: 5901:7d7eac6e31df
user: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
date: Tue Nov 04 19:56:23 2014 +0900
description:
Upstream: support named location for X-Accel-Redirect.

diffstat:

src/http/ngx_http_upstream.c | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)

diffs (43 lines):

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
@@ -2218,19 +2218,26 @@ ngx_http_upstream_process_headers(ngx_ht
}

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 (r->method != NGX_HTTP_HEAD) {
- r->method = NGX_HTTP_GET;
- }
-
- ngx_http_internal_redirect(r, &uri, &args);
+
+ 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;
+ }
+
+ ngx_http_internal_redirect(r, &uri, &args);
+ }
+
ngx_http_finalize_request(r, NGX_DONE);
return NGX_DONE;
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: support named location for X-Accel-Redirect.

Maxim Dounin 410 November 11, 2014 09:04AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready