DuendeSoftware / Support

Support for Duende Software products
20 stars 0 forks source link

redirect uri is with http instead of https #1255

Closed chandraarora closed 3 months ago

chandraarora commented 3 months ago

Which version of Duende BFF are you using? 2.2

Which version of .NET are you using? 8

Describe the bug I have created bff server with .net 8 and it works fine locally with Identity server running locally. I have deployed Identry server on AKS (Azure kubenetes services) and BFF is also running on the same AKS. I have given the redirect url starts with https in the config. I get an error redirect uri is invalid because it start with http instad of https. There is somewhere redirect uri is changing or my config is wrong. It seems me issue with aks or my config. Any hint will be a great help to me.

chandraarora commented 3 months ago

It is solved after this change

app.Use((context, next) => { context.Request.Scheme = "https";

return next();

});

AndersAbel commented 3 months ago

Adding a middleware that unconditionally sets the scheme works if that is always the case. In a general case it is better to configure forwarded headers. The reverse proxy supplies the original protocol scheme and host names in extra headers that are then handled by Asp.Net Core through the forwarded headers middleware: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-8.0