Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Allow http_auth_request_module to forward 302 responses

Maxim Dounin
February 18, 2012 04:46PM
Hello!

On Sat, Feb 18, 2012 at 09:19:18AM -0500, Maxim Khitrov wrote:

> Hello Maxim,
>
> The attached patch allows your http_auth_request_module to forward a
> 302 response and the associated "Location" header to the client. The
> goal is to allow the authentication back end to redirect the client to
> a login page instead of using WWW-Authenticate header.

You may get the same result by returning 401/403 and using
appropriate error_page handler. I don't actually see a reason to
handle 302 specially here.

Something like this should work (not tested):

location / {
auth_request /auth;
auth_request_set $auth_redirect $upstream_http_location;
error_page 401 = /auth_redirect;
}

location /auth {
proxy_pass http://auth_backend;
...
}

location /auth_redirect {
return 302 $auth_redirect;
}

Maxim Dounin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Allow http_auth_request_module to forward 302 responses Attachments

Maxim Khitrov 1252 February 18, 2012 09:20AM

Re: [PATCH] Allow http_auth_request_module to forward 302 responses

Maxim Dounin 536 February 18, 2012 04:46PM

Re: [PATCH] Allow http_auth_request_module to forward 302 responses

Maxim Khitrov 539 February 18, 2012 06:50PM

Re: [PATCH] Allow http_auth_request_module to forward 302 responses

Maxim Dounin 528 February 18, 2012 11:02PM

Re: [PATCH] Allow http_auth_request_module to forward 302 responses

Maxim Khitrov 2169 February 19, 2012 08:42AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 281
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready