rewritten redirect with relative url

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


Hi,

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.

-dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120131/cdd7c306/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rewrite_redirect.patch
Type: application/octet-stream
Size: 831 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120131/cdd7c306/attachment.obj>


More information about the nginx-devel mailing list