newbie question

Maxim Dounin mdounin at mdounin.ru
Wed Oct 12 14:02:10 UTC 2016


Hello!

On Wed, Oct 12, 2016 at 12:43:12PM +1100, Alex Samad wrote:

> Hi
> 
> I am trying to create a dynamic auth address
> 
> 
> # grab ssoid
> map $cookie_SSOID $ssoid_cookie {
>     default "";
>     ~SSOID=(?P<ssoid>.+) $ssoid;
> }
> 
> 
>    location /imaadmin/ {
>         proxy_cache off;
>         proxy_pass http://IMAAdmin;
> 
> 
> 
>         auth_request /sso/validate?SSOID=$ssoid_cookie&a=imaadmin;
> 
> 
> what I am trying to do is fill the variable ssoid_cookie with the
> cookie value for SSOID in the request or make it blank
> 
> then when somebody tries to access /imaadmin make the auth request
> /sso/validate?SSOID=$ssoid_cookie&a=imaadmin;
> 
> but i get this
> GET /sso/validate%3FSSOID=$ssoid_cookie&a=imaadmin HTTP/1.0

This is because the "auth_request" directive doesn't support 
variables, and also doesn't support request arguments.

Try this instead:

    location /imaadmin/ {
        auth_request /sso/validate;
        ... proxy_pass ...
    }

    location = /sso/validate {
        set $args SSOID=$ssoid_cookie&a=imaadmin;
        ... proxy_pass ...
    }

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list