-
Notifications
You must be signed in to change notification settings - Fork 219
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
[Bug] Unable to authenticate using Azure front door and AAD #1076
Comments
@TaylorTheDeveloper : would this article help you? Deploy to App Services Linux containers or with proxies |
Thanks for sharing that- I did check that out and had gone down a similar path but did not have success using forwarded headers. It's worth noting that I am using windows app service, not linux app services. I'm also using .Net Core 3.1. From that article:
If I update the last line to highlight the difference:
|
@Tratcher can you please help for this case? |
Start with the troubleshooting instructions at https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-5.0#troubleshoot to capture the incoming headers. Please share your forwarded headers middleware settings along with the troubleshooting output. |
Thanks @Tratcher for pointing me in this direction- Going through this more in depth and adding logging around the scenario I finally figure out what's going on. The middleware doesn't seem to be doing that update as the documentation seems to indicate it would. I was able to update the request host to be the correct endpoint manually using the X-Forwarded-Host header (see below) according to the documentation:
My forwarded header configuration in ConfigureServices:
Simply called in Configure: Here's what I observed logging the headers (minified):
I inspected further and found that my
Here's what the flow looks like after making this update:
|
Just wanted to follow up... Is this expected that I still have to update the request host? Or is this a bug? |
Do your requests have x-forwarded-for headers? A lot of the processing is tied to those. You can try disabling that with: |
Ahh, that was it. I did have x-forwarded-for headers as well. Opting for just XForwardedHost + XForwardedProto did the trick without requiring me to override anything. Thanks! |
Which version of Microsoft Identity Web are you using?
Microsoft.Identity.Web 1.8.1
Where is the issue?
Is this a new or an existing app?
This is a new app that requires authentication + azure front door.
Repro
I'm trying to simply place my authenticated web app behind Azure Front door.
I have an Azure front door with a single front end host. This maps to a single web app on the back end right now. The back end is configured as follows:
![image](https://user-images.githubusercontent.com/5298174/111699298-2b697180-87f5-11eb-8364-30d4e7e0162f.png)
![image](https://user-images.githubusercontent.com/5298174/111699490-72effd80-87f5-11eb-8948-147895da3587.png)
The rules are configured as follows:
Expected behavior
When the user hits the frontdoor endpoint their request is forwarded to origin to login. The logged in user is never redirected away from the front door end point and only ever sees the front door endpoint.
Actual behavior
When the user hits the frontdoor endpoint they're redirected to the login page. Once logged in via the login ui, they are redirected back to the app service endpoint and not the front door endpoint.
Possible solution
I did find a similar bug (#115), and conceptually I think a similar issue is happening but did not have success with implementing this. Futhermore looking for guidance in general. Essentially, I think the cdn makes a request to origin and origin only knows to reply with it's own hostname so when we hit the login page, origin has already said 'redirect to origin'. How can I reliably make this redirect back to the front door?.
Additional context / logs / screenshots
Add any other context about the problem here, such as logs and screenshots.
The text was updated successfully, but these errors were encountered: