--- src/http/modules/ngx_http_auth_request_module.c 2017-03-03 12:55:31.236056000 +1000 +++ src/http/modules/ngx_http_auth_request_module.c 2017-03-03 13:09:15.908223000 +1000 @@ -161,6 +161,29 @@ return ctx->status; } + if (ctx->status == NGX_HTTP_MOVED_TEMPORARILY) { + sr = ctx->subrequest; + + h = sr->headers_out.location; + + if (!h && sr->upstream) { + h = sr->upstream->headers_in.location; + } + + if (h) { + ho = ngx_list_push(&r->headers_out.headers); + if (ho == NULL) { + return NGX_ERROR; + } + + *ho = *h; + + r->headers_out.location = ho; + } + + return ctx->status; + } + if (ctx->status >= NGX_HTTP_OK && ctx->status < NGX_HTTP_SPECIAL_RESPONSE) {