﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
559	improvement proposed for ngx_http_auth_request_module	David Coutadeur		"
Hi all,

I propose a nice functionnality which is to provide redirection with the ngx_http_auth_request_module.
Ie if the subrequest sends a redirect, then the auth_request will get the redirection and send it to the user.

Here is the patch:

--- ngx_http_auth_request_module.c	2014-05-16 18:36:04.312203467 +0200
+++ ngx_http_auth_request_module.c.patch	2014-05-16 18:35:39.004204963 +0200
@@ -138,6 +138,22 @@
             return ctx->status;
         }
 
+	/* case redirect */
+	if (ctx->status == NGX_HTTP_MOVED_TEMPORARILY) {
+            sr = ctx->subrequest;
+            h = sr->headers_out.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_UNAUTHORIZED) {
             sr = ctx->subrequest;



Just a warn: the location field from the subrequest does not seem to be taken into account... Maybe somebody can see why ?

"	enhancement	closed	minor		nginx-module	1.5.x	wontfix			Linux debian-wheezy-64-lemon 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux	"nginx version: nginx/1.6.0
built by gcc 4.7.2 (Debian 4.7.2-5) 
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --prefix=/opt/nginx --http-log-path=/var/log/nginx16/access.log --error-log-path=/var/log/nginx16/error.log --lock-path=/var/lock/nginx16.lock --pid-path=/run/nginx16.pid --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module"
