diff src/http/v2/ngx_http_v2_filter_module.c @ 6852:d15172ebb400

Core: relative redirects (closes #1000). The current version of HTTP/1.1 standard allows relative references in redirects (https://tools.ietf.org/html/rfc7231#section-7.1.2). Allow this form for redirects generated by nginx by introducing the new directive absolute_redirect.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 21 Dec 2016 23:10:51 +0300
parents 3834951e32ab
children 25203fc377fb
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2_filter_module.c
+++ b/src/http/v2/ngx_http_v2_filter_module.c
@@ -263,7 +263,9 @@ ngx_http_v2_header_filter(ngx_http_reque
 
     if (r->headers_out.location && r->headers_out.location->value.len) {
 
-        if (r->headers_out.location->value.data[0] == '/') {
+        if (r->headers_out.location->value.data[0] == '/'
+            && clcf->absolute_redirect)
+        {
             if (clcf->server_name_in_redirect) {
                 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
                 host = cscf->server_name;