rewritten redirect with relative url

Dave Bailey dave at
Tue Jan 31 23:39:03 UTC 2012


In ngx_http_upstream_rewrite_location(), r->upstream->rewrite_redirect may
replace the Location header value with a new value.  This value ends up
going through ngx_http_header_filter(), and if it's a relative URL, the
header filter adds a scheme and host to it.  However, if
r->upstream->rewrite_redirect declines (rc = NGX_DECLINED) to rewrite the
redirect, the value does not go through ngx_http_header_filter() even if it
is a relative URL.

Is this intended behavior?  If it is not, I attached a patch that sets
r->headers_out.location consistently.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rewrite_redirect.patch
Type: application/octet-stream
Size: 831 bytes
Desc: not available
URL: <>

More information about the nginx-devel mailing list