oauth2_proxy icon indicating copy to clipboard operation
oauth2_proxy copied to clipboard

Use X-Auth-Request-Redirect if rd not given

Open iain-buclaw-sociomantic opened this issue 7 years ago • 4 comments

For consistency with sign_in, and to be able to pass arguments escaped to the redirect url.

i.e:

auth_request    /oauth2/auth;
error_page      401 = /oauth2/start?rd=$request_uri;

When calling:

curl http://myserver/?foo=123&bar=456&uid=789

The result of req.Form.Get("rd") is foo=123. The rest of the uri string is discarded by oauth proxy.

iain-buclaw-sociomantic avatar Jan 12 '18 14:01 iain-buclaw-sociomantic

The actual problem here is that nginx was not told to url-encode $request_uri to be a query param value. Searching around, it looks like there really isn't a good way to do that ... possibly just this out-of-tree module https://github.com/openresty/set-misc-nginx-module#set_escape_uri

ploxiln avatar Jan 12 '18 21:01 ploxiln

Yeah, I've already had a look around before concluding this. I'm not building a custom version of nginx. :-)

iain-buclaw-sociomantic avatar Jan 15 '18 16:01 iain-buclaw-sociomantic

Just FYI, the sign_in page is not affected by this, hence re-using X-Auth-Request-Redirect header.

iain-buclaw-sociomantic avatar Jan 15 '18 16:01 iain-buclaw-sociomantic

This difference between /start and /sign_in is actually quite annoying and forces to use extra step for users when I don't need it (everyone authenticate with one provider) +1 for this patch

asergeyev avatar Jan 16 '18 14:01 asergeyev