diff src/http/ngx_http_header_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 b3b7e33083ac
children 25203fc377fb
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -309,7 +309,8 @@ ngx_http_header_filter(ngx_http_request_
 
     if (r->headers_out.location
         && r->headers_out.location->value.len
-        && r->headers_out.location->value.data[0] == '/')
+        && r->headers_out.location->value.data[0] == '/'
+        && clcf->absolute_redirect)
     {
         r->headers_out.location->hash = 0;