summaryrefslogtreecommitdiffhomepage
path: root/src/http/v2
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2016-12-21 23:10:51 +0300
committerRuslan Ermilov <ru@nginx.com>2016-12-21 23:10:51 +0300
commitdd70e741970c841a1555911f6468b39870c0607b (patch)
treeeaefda6b80598c554414e6b147e93c6ecdbf31c5 /src/http/v2
parentd1f524d0b3e013f23bb9456aa4f2c35916934c27 (diff)
downloadnginx-dd70e741970c841a1555911f6468b39870c0607b.tar.gz
nginx-dd70e741970c841a1555911f6468b39870c0607b.tar.bz2
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.
Diffstat (limited to 'src/http/v2')
-rw-r--r--src/http/v2/ngx_http_v2_filter_module.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c
index 8abca4dd2..f2f0d1e41 100644
--- 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_request_t *r)
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;