I'm trying to send a variable via the auth_request
directive so that I can then use the variable for the actual authorization. I'm trying to do it with a GET request, but if other methods work that is fine. It will also work if there is a way to reference the auth_request
. I'm trying to create one location that can verify every app instead of a different location for each app.
auth_request /auth?app=myapp;
...
location /auth {
internal;
proxy_pass http://127.0.0.1:8000/portal/auth?PASS_GET_VARIABLE;
}
CodePudding user response:
Turns out the variable app=myapp
is already being passed. The way to do this is with a rewrite
and changing the proxy_pass
URI.
auth_request /auth?app=myapp;
location /auth {
internal;
rewrite ^/auth(.*) /portal/auth$1;
proxy_pass http://127.0.0.1:8000;
}
If no URI is specified, the location match is passed as the URI. So in this example, /auth?app=myapp
would get changed to /portal/auth?app=myapp
, and it would be passed along.