Question about IF and auth subrequest

Maxim Dounin mdounin at mdounin.ru
Wed Feb 24 20:03:09 UTC 2021


Hello!

On Wed, Feb 24, 2021 at 06:44:49PM +0100, Vincent Blondel wrote:

> Thank You for the swift answer Maxim.
> If I understand, you mean something like that should be going to Work ...
> 
> location /subrequest/ {
> proxy_pass xxx;
> }
> location /anyrequest/ {
> auth_request /subrequest/;
> error_page 400 = @fallback;
> proxy_pass xxx;
> }
> location @fallback {
> proxy_pass_request_body off;
> proxy_set_header Content-Length "";
> proxy_pass http://backend;
> }

Sort of, but you have to use 401 or 403, see the auth_request 
documentation (http://nginx.org/en/docs/http/ngx_http_auth_request_module.html).

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list