-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
redirection from /auth
to /auth/$STATE
fails when VP is hosted at a path such as /vouch
(redirects to /auth/$STATE
instead of /vouch/auth/$STATE
)
#373
Comments
@pommedeterresautee interesting. I can't reproduce the behavior. Could you please provide your nginx config in a gist as described in the README. Please move your VP config there too. Line numbers really help for this stuff. Why do you have the rewrite? What does that help you accomplish? |
@pommedeterresautee your VP log only shows calls to a healthz endpoint Where are the errant requests with the URL you've described? Why is there no return call to /auth from Okta? |
I will recapture and repost, obviously I failed in my copy pasting tentative. |
Your cookie.secure is false but your auth endpoint is https. Usually they should align. Probably should be removed to default secure: true. |
I have updated the log (same link as before) and moved the VP/nginx config to gist (link in the first message too). |
@pommedeterresautee sorry for the delay I now see the call to Please offer at least two full roundtrips including all errors and failures Thanks |
@gsx95 I'm wondering if this might be related to #349 If would the 302 redirect at push the request to hmm. That's an nginx/VP alignment issue I think. |
Hi, thank you for your message. Logs have been updated in the link present in the first message. Regarding |
You are right @bnfinet, this is caused by VP's hard redirect to |
I would be happy to test that version when ready and report here for results. |
thanks @gsx95 would you be able to publish a fix and confirm it works for the common case (VP at Otherwise it will have to wait for me to get to it :) |
/auth
to /auth/$STATE
fails when VP is hosted at a path such as /vouch
(redirects to /auth/$STATE
instead of /vouch/auth/$STATE
)
@pommedeterresautee would you be in a position to pull the branch It looks to me like this simple fix is working. |
Tks for the fix. git switch fix/373_vouch_in_a_path
docker build -t ghcr.io/xxx/vouch:latest -t ghcr.io/xxx/vouch:1.0.1 .
docker push ghcr.io/xxx/vouch:latest
docker push ghcr.io/xxx/vouch:1.0.1 Then I deployed that image on our stack, but I am still redirected to |
In the meantime, here's a dirty little workaround, assuming you don't need that
|
@bnfinet I'm just new to this project and looking into how to configure it in my k8s cluster. I have all my apps under path context and not as sub domains. Do you think its possible or this will only work if the apps are under subdomain? |
I have made it work with all apps being under path behind an nginx reverse proxy. As long as your can configure your kubernetes similar to the workaround above, it should be possible. |
Thanks @MCOfficer I would give it a try. |
When VP is run behind Nginx "in a path" such as `/vouch/validate`, `/vouch/login` etc, its necessary to adjust the path that the session cookie is set into and the 302 redirect from `/vouch/auth` to `/vouch/auth/$STATE`
@beingamarnath @pommedeterresautee @MCOfficer I've just published a fix to the By configuring Nginx to send the
thanks much! |
@bnfinet Since I'm configuring Vouch for the first time, it took me some time to get it working with pure domain based approach as I wanted a working setup first to compare the behavior with. Anyhow I picked up this path based setup for testing. App: https://example.com/app I configured the Also the Vouch ingress had to be adapted like
With the above mentioned changes, vouch was able to figure out its hosted under path(using the But then it failed with the following error |
@beingamarnath thank you for testing. To be clear... did you build the branch |
I just picked up the image with from My nginx config is the default that comes out when we install Ingress nginx controller via Helm Chart. (I'm not sure how to pick up this info at the moment as its not a static setup) |
@beingamarnath thanks, what does the VP log show for the |
Is this the source that the is |
All the logs for one single request - https://gist.github.com/beingamarnath/127a6277e2085cdde744fa9456c330d5 The ingress configuration of the app itself is available here https://gist.github.com/beingamarnath/0e1cd213edb4b6eab946099b7a5900af The external auth is triggered and it redirects to the adfs server and I'm able to login. To configure the |
@beingamarnath those logs do show Could you please offer your VP config and also show the VP startup in your logs. Pretty much I need the stuff outlined in the README. |
@bnfinet Thanks for looking into it. Here is the requested info |
When VP is run behind Nginx "in a path" such as `/vouch/validate`, `/vouch/login` etc, its necessary to adjust the path that the session cookie is set into and the 302 redirect from `/vouch/auth` to `/vouch/auth/$STATE`
I tried using the above-mentioned setup with the image tag for that branch, (only with |
On the other hand I've found a partial workaround with the apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
name: vouch-proxy
spec:
rules:
- host: PLACEHOLDER
http:
paths:
- backend:
service:
name: vouch-proxy
port:
name: http
path: /sso(/|$)(.*)
pathType: Prefix
- backend:
service:
name: vouch-proxy
port:
name: http
path: /()(auth.*)
pathType: Prefix
tls:
- hosts:
- PLACEHOLDER
secretName: PLACEHOLDER When I do this I get redirected back to I am able to get this to kind of work automatically by adding the following configuration snippet to my ingress annotations above, BUT it still lands you on the 400 error page, and then you need to reload/re-hit that url before it will save the correct session in vouch and let me access the secured page: nginx.ingress.kubernetes.io/configuration-snippet: |
rewrite (/auth/[^/]+)/(\?.*$) $1$2; |
@jskrzypek thanks for testing and hacking on this a bit @jskrzypek @beingamarnath and all, could you please try with the latest updates to FYI - the docker images are not currently getting built for branches (see #406) |
@bnfinet I'll try to test that next week as I'm already nearing EoD. Fwiw my coworkers on Chrome are not having that issue with needing to reload to get the configuration snippet to work |
@jskrzypek friendly nudge. If you had any time to test I'd love to confirm its working and then get it merged. |
Apologies, I had a family health crisis last week and was out of office
sInce last Tuesday and I’m still playing catch-up. I will try to test it
out in the next few businesses days, but it may only be next week.
|
The current code in (I suffered a few hours missing the info that the image quay.io/vouch/vouch-proxy:fix_373_vouch_in_a_path is not up to date and took time to figure out that the path of VouchSession cookie set by /login is wrong and how I can tweak it with nginx... xD). However, wouldn't be the correct solution to introduce a config property for the context path in VP and deal with it internally, instead of requiring it to be tweaked in nginx? I have seen such for example in Kibana and Prometheus. I think it would be reasonable as this setup seems to be pretty common, and the nginx tweak is not trivial. |
@balee thanks for testing I've added a config option for https://github.com/vouch/vouch-proxy/tree/fix/373_vouch_in_a_path_document_root If you (or @jskrzypek or anyone else) was able to test and to check the README for clarity it would be much appreciated. Really I'm on the fence about this. I'm always hesitant to add new knobs to the VP config.
However I do see that it seems clunky and requires all of the paths to be set explicitly ( Sorry for the confusion on the docker image. I have removed the image |
@bnfinet I can confirm that I use it in k8s with nginx ingress, so it is a bit different, but I`d raise up a few things:
|
released in Thanks again to @balee @jskrzypek @beingamarnath @MCOfficer and @pommedeterresautee for the testing and debugging support. Very pleased to get this fix into VP. |
Use a Paste Service
Link to logs with
vouch.testing
set to trueDescribe the problem
Vouch has been configured to work with Okta and nginx.
With all version up to 0.19.2 it works well.
When we update to 0.20.0 or newer versions, the process works until the last redirection after being correctly logged.
The reason is that the redirect URL is wrong, it forgets a part.
Instead of redirecting to
https://app-dev.our-domain.something/vouch-webapp-dev/auth
it sends tohttps://app-dev.our-domain.something/auth
and it finishes with a 404 error.Last lines of the kindof Vouch report generated in testing mode through the browser (after the Okta login screen):
Expected behavior
We expect that version 0.20.0 or newer to work like version 0.19.2 or older, in particular to not get
Additional context
Vouch config updated (with
secure: true
)We run Vouch on docker-swarm:
image: voucher/vouch-proxy:0.19.2
Tests has been run on Chrome 0.89 and Ubuntu 20.10
The text was updated successfully, but these errors were encountered: