-
Notifications
You must be signed in to change notification settings - Fork 53
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
Redirect URI while behind a nginx proxy #134
Comments
Hi @leshravnya, thanks for bringing this up. Fastapi-sso currently does not handle any |
One of the standard solutions is to let the application know which domain it is being served on. Just add to the configuration of your This solution does not require middleware, but it will not work if your application is accessible from multiple domains. |
I am also facing similar kind of issue, I am running my fastapi application in a k8s cluster and am using ingress-nginx for routing: Here are the relevant code files: Thankyou. |
Hi @adityabhattad2021, this seems weird, because httpx is used to communicate with the oauth provider (Google in your case), I am not sure this is an issue with the proxy. Could you please provide the full traceback of the error? |
This seems more of an issue with the setup itself. Try using a service type NodePort instead of a full Ingress if you're not using SSL. That way, you'll rapidly know if the library works, but it does. I should know cause I have similar setup and it works like charm: k8s, Traefik (instead of Nginx) and CertManager. For the record it used to work well 2 years ago when I was using Ingress Nginx. Hope it helps! |
Here:
|
This is really weird, it seems more like a network trouble, are you sure the requests can go through and are not blocked on egress? |
Yes the requests do go through, I even tried to log those as well using this middleware
|
Happens to me as well. Deployed app on azure behind nginx and keep getting redirect uri mismatch Actually this happens locally as well if my app is run in docker, but only if I build as linux/amd64 I also get {"detail":"'code' parameter was not found in callback request"} |
@K1T3K1 hey, are you running your app using To your second problem, could you refer to #164 and preferably post debug logs so that I can further investigate 🙏 Thank you all for reaching out! |
Also, always make sure that your proxies (nginx, traeffik, etc.) know that they should set |
I am trying to deploy my app using nginx as a proxy. My
fastapi
app is running onhttp://localhost:8000
and thenginx
is listening to the public IP on port 443. I have configured theredirect_uri
for the login ashttp://localhost:8000/auth/callback
. However, after authentication from the SSO server, it redirects to thehttp://localhost:8000/auth/callback
instead of thehttps://domain.example.com/auth/callback
.I tried to change the auth URI from
http://localhost:8000/auth/callback
tohttps://domain.example.com/auth/callback
and I get the below error in the callback. I need help in resolving this issue.The text was updated successfully, but these errors were encountered: