auth_request and multiple sequential subrequests

Pavel Kolla pavelkolla at gmail.com
Thu Feb 3 14:16:12 MSK 2011


Thanks to Piotr & Maxim for helping with suppling proper headers along with 
auth_requst!

Now I got a question about possibility to use auth_request in internal 
subrequest similar to this:

location /t/
{
    set $t 0;
    auth_request    /t1;
    echo "base $t";
}

location /t1
{
#   internal
    auth_request    /t2;
    set $t 1;
    echo "t1 $t";
}

location /t2
{
#   internal
    set $t 2;
    return 403;
}

That doesn't really function as i expect and result in:

$ curl host/t/
base 1
$ curl -I host/t1
HTTP/1.1 403 Forbidden

(for sake of experiment I actually created the dirs so nginx doesn;t complain 
with 404s on second request, but originally i had them as internal)

The main idea is to have 2 sequential checks where only success in both leads 
to handling /t/, but each check can return different errors depending on 
internal processing.

At this stage i'm not even sure if it is possible to use auth_request directive 
in a subrequest, so i seek for wisdom here...




More information about the nginx mailing list