-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use X-Original-URI for redirect if used in as 401 error_page #247
base: master
Are you sure you want to change the base?
Conversation
@sjoerdmulder you may want to fetch upstream and repush, I suspect your build is fine and travis was just broken. It should work now. |
@sjoerdmulder Could you pass along a sample nginx config that you're using for this? Redirecting with 401 error_page doesn't seem to set X-Original-URI for me. |
@semenko You should pass it with
|
Hi, |
@reist Good one, i also added it to the OAuthStart section. Build is somehow failing with another unrelated message? |
Build is fixed in #299 if you want to try with that. |
Will this land soon? |
This is useful in Nginx auth_request mode, if a 401 handler is configured to redirect to the sign-in page. As the request URL does not reflect the actual URL, the value is taken from the header "X-Auth-Request-Redirect" instead. Based on bitly#247
This is useful in Nginx auth_request mode, if a 401 handler is configured to redirect to the sign-in page. As the request URL does not reflect the actual URL, the value is taken from the header "X-Auth-Request-Redirect" instead. Based on bitly#247
#319 has been merged, so this can be closed (other than the |
Current master redirects you to the original page you were trying to view, if you use oauth2_proxy in the original proxy mode, or if you use The problem that remains (in master) is when you use I think this proposed fix does not cover enough cases correctly. If the sign-in page is enabled, and the nginx config is not particularly sophisticated, you'll get the redirect loop that @ashkulz mentioned, because the sign-in page will post to the oauth-start page which will get its own URI in the redirect header (depending on how sophisticated the nginx config is), and when oauth completes, the callback page will end up redirecting back to the oauth-start URI. I think there are other cases like this as well. Also, it looks like if the sign-in page/button is disabled, and proxy mode is used (instead of nginx auth_request), the redirect back to the originally desired page also does not work, and needs a different fix (getting the So, I think more than this is needed for |
Shouldn't this be using the X-Forwarded-* headers to be compatible with other (less configurable than nginx) proxies? |
This is useful in Nginx auth_request mode, if a 401 handler is configured to redirect to the sign-in page. As the request URL does not reflect the actual URL, the value is taken from the header "X-Auth-Request-Redirect" instead. Based on bitly#247
Otherwise it always redirects to /oauth2