-
Notifications
You must be signed in to change notification settings - Fork 1.2k
RD form value on login page #456
Comments
Currently it's not supported to add
|
I see it now why it stopped working for me. nginx-intress-controller for kubernetes fixed the rd param handling in nginx-0.9.0-beta.12 version with this commit: kubernetes/ingress-nginx@b2be9f0#diff-b7803798d356c6c17a90d93cc58bdbaaR588 Correct me if I am wrong, but adding X-Auth-Request-Redirect header won't solve the problem unless rd param is still being set in |
Reading code seems like The preferred way would be to remove SingInPath from RequestURI near that code: Lines 367 to 373 in b1e29c3
|
see #427 (also I forgot about a third option: don't use the sign-in page at all, redirect straight to /start) |
Assuming I still want to use login page I prepared a PR #457 which fixes both mentioned use-cases. |
Yes, I am facing the exact same issue. I tried to upgrade from nginx-0.9.0-beta11 to nginx-0.9.0-beta15 and authentication started to fail (infinite redirect loop). I tracked this to the exact change @krogon-dp mentioned. PR #457 and #427 seem to be stuck so I am not sure what to do. For now I am sticking to nginx-controller-beta11 which is suboptimal. @aledbf @ploxiln any suggestion ? Thanks guys |
Is everyone using an old ingress-controller? Or using I think that the problem can be solved more elegantly if |
Another option would be to use Lines 420 to 423 in b0c1c85
Maybe changing this logic to allow same domain/subdomains is better..? |
Sorry for spam :) But this ended up working just like wanted... In the ingress definition, add:
Then on the index-page, add something like <script>
// https://stackoverflow.com/a/901144/452081
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var redirect_url = getParameterByName("redirect", window.location.href) || "";
if(redirect_url.match('^https://([a-z0-9-]+\.)?domain\.com/.*') window.location = redirect_url;
</script> This redirects me, to the original url, even if it in another sub-domain.. |
If it works for you, great, but that's what would be called an "open redirect" |
@ploxiln yes, sorry about that.. It was ment as a POC for those needing such a solution. I just wanted to post it and go to bed :) I'm updating with a comment for verification of the url.. |
Correct rd form value when param not specified.
https://example.domain.com/oauth2/sign_in
Incorrect rd form value when param specified, making redirect to login_page again (loop)
https://example.domain.com/oauth2/sign_in?rd=/
Version: 2.2.1-alpha
The text was updated successfully, but these errors were encountered: