-
Notifications
You must be signed in to change notification settings - Fork 33
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
Ingress questions/issues #97
Comments
I'm running into probably the same issue causing the redirect uri when logging into my web app using Azure AD and Microsoft Identity to be http instead of https. This happens even when using the forwarded headers middleware in my asp.net core 6.0 app. |
I had the same problem, after a lot of trial and error the workaround was to add a middleware to "fool" the OAuth middleware into constructing a https scheme. There may be other unintended consequences you need to consider, but this got me past the redirect_uri issue. The idea is suggested here
I spent time trying some of the following header forwarding ideas but they did not solve the redirect_uri problem, included here for reference of what wasn't helpful. |
you can disable http to https redirection by passing in the --allow-insecure parameter. Would this solve your issue? @amolenk |
Thanks for the reply @kendallroden. I'm not @amolenk, but I think the first part of the issue is that when accessing the ingress over HTTPS one would expect the value of the This could cause problems with middleware that now assumes the application is being accessed insecurely over http. It is possible to fool the application by inserting an extra middleware like @ecosgrave demonstrates, but in the linked documentation this is suggested for scenarios where forwarded headers are not present at all. |
I’ve solved my Identity Server issue by letting Identity Server generate HTTPS urls when it finds an For those interested, I'm adding Container Apps support to the eShopOnDapr sample app. Bicep files can be found here: https://github.com/dotnet-architecture/eShopOnDapr/tree/amolenk/containerapps/deploy/containerapps |
Thanks for the confirmation @amolenk. I had briefly looked through the eShopOnDapr code before on GitHub and I want to dive deeper into it soon. What I've seen already showed me how some new and interesting ways of doing things, so thanks for that! |
Hi all we are working on a fix and will update the thread when it is completed and available |
make sure the port specified is correct as well |
I run into same issue. Wonder if there is a fix for this issue yet ? |
This issue should be fixed. Correct proto can be returned from HTTP/HTTPS endpoint.
Accessing http://xxxxxx
|
@Hoang-Minh are you still having the issues? If so, could you provide repro steps? |
@zhenqxuMSFT I no longer have this issue after modifying my yml file. |
Closing issue as fixed. |
@Hoang-Minh how you modified the yml file? |
@kjeske This is how I resolved the issue: Set the ASPNETCORE_FORWARDEDHEADERS_ENABLED = true AND Add these two lines suggested from @Venkatesan to my ingress yml nginx.ingress.kubernetes.io/ssl-redirect: "true" Everything works perfectly after that. |
Thank you. I spent some time figuring out why ASPNETCORE_FORWARDEDHEADERS_ENABLED was the way and not configuring it in the Startup.cs when you have ASP.NET MVC Core app. But I found the answer. Here is the code that makes it working without having ASPNETCORE_FORWARDEDHEADERS_ENABLED set to true: services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
}); The thing that makes a difference is this: options.KnownNetworks.Clear();
options.KnownProxies.Clear(); Here explanation: |
@kjeske I tried your settings with my .net 6 application and it did not work. Maybe I was missing something. |
@Hoang-Minh that was only the configuration. It's important to also use it your application builder:
|
I’ve got some questions about how ingress actually works. I’m testing with a simple echo container (https://hub.docker.com/r/mendhak/http-https-echo) to view the HTTP request headers sent to the container application. I’m deploying the app with Bicep:
When I access the HTTPS application URL from the Azure Portal, I get the following response:
Why is the value of the
x-forwarded-proto
headerhttp
? I would’ve expected this to behttps
because the client calls the ingress endpoint over HTTPS.Also, is theRetested this andallowInsecure: true
ingress option supported yet? When I use this option I still get redirected when making an HTTP call.allowInsecure: true
seems to work fine.Finally, I also tried calling the HTTPS endpoint of the echo container (which is 8443) by changing my config:
This gives me the following error when I try to call the app:
upstream connect error or disconnect/reset before headers. reset reason: connection termination
The text was updated successfully, but these errors were encountered: