-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Authentication.AzureAD.UI: Incorrectly uses http instead of https in redirect URI #22572
Comments
Have you configured the header forwarding middleware? Inside the container it's likely that your app is listening on HTTP, and Azure is terminating the HTTPS at the load balancer before forwarding the requests onward. |
@blowdart thanks for jumping in! I took a stab at doing that here: https://github.com/excellalabs/konmaripo/pull/11/files Was not successful but willing to bet that it's because I'm getting something wrong. Continuing to research ways to approach it. |
@blowdart just to confirm -- there is no |
We try to autodetect the protocol, and honestly because the protocol can affect other things like cookie settings it's better to get the header forwarding working. I'd suggest creating a page that dumps all the inbound headers on a request and making sure that the expected X-Forward-* headers are there. I haven't used Azure's containers myself, but I'd bet that instead of one proxy host as you'd see in a web application there is in fact two, the ARR level that sits in front of everything, and then the container host, so you'd need to adjust the middleware to trust two proxies, rather than the default one, and potentially add a known proxy address, something like
If you can share the X-Forwarded headers then one of the middleware folks should be able to give advice when they wake up :) |
The header forwarding may have indeed resolved it; turns out it helps if you actually call I'll report back either way and will include the additional info if we need to go that route. @blowdart this seems like it's worth raising an issue to the VS templating team about because this is my out of the box experience specifically when checking the boxes for Azure AD and docker support. Do you see any reason why I shouldn't raise that issue? |
Oh yes, definitely, if there's a docker template and checkboxes the template should wire it up. Glad you got it working, I was desperately trying to figure out docker over my first morning coffee and it wasn't going well. |
Update: it definitely did resolve things. I also had to disable the auth from within the Azure AD portal since we were wiring it up directly (I'd enabled it during troubleshooting.)
Thar be dragons. :) Thanks again for the help! I'll see if I can find a place to raise the follow-up issue, but for now, we can consider this closed. |
Describe the bug
I believe this issue is similar to AzureAD/microsoft-identity-web#115 and the fixes/workarounds may also be the same.
When deploying in a Linux container, the URI for redirects utilizes http even when my site is hosted via
https
. This prevents me from being able to utilize Azure AD's redirect, which requires https, and thus does not allow logging in from my application. Instead I receive:I've tried the workaround of adding an
AzureAd__RedirectUri
app setting, but this does not appear to have any effect and I believe it may apply only to Microsoft.Identity.Web and not this project (unsure exactly how those are related)To Reproduce
Repo with this issue: https://github.com/excellalabs/konmaripo
https
)https
) to your redirect URI list.Expected behavior: When accessing the site, I am redirected to Azure with a redirect URI of https (which is allowed), and thus logged in and redirect back to my app.
Actual behavior: I am taken to the Azure login, but with a redirect URL of
http
instead ofhttps
, leading me to receive an error of:Exceptions (if any)
Further technical details
The text was updated successfully, but these errors were encountered: