authentication - nginx auth_request: access original query parameter -


i'm trying figure out if possible forward query-parameter original url auth_request handler/service?

users should able add api-token query-parameter this: https://example.com/api/user?token=237263864823674238476

and not via header or cookie. can access token parameter somehow in auth-service? or write token query-parameter in custom header nginx?
tried far:

location = /api/user {   auth_request /auth;   proxy_set_header x-auth-token-from-query $arg_token;    proxy_pass http://<url>; } 

/auth endpoint doesn't x-auth-token-from-query header after returning 200 upstream-proxy header.

you'll want pass url (the uri) auth-request endpoint well. can in 1 go:

location = /api/auth {   proxy_set_header x-original-uri $request_uri;   proxy_set_header x-original-method $request_method;   proxy_pass_request_body off;   proxy_set_header content-length "";    proxy_pass http://<url>; } 

bonus: passed method! :tada:


Comments