Replies: 1 comment
-
Figured it out!
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.All;
options.ForwardLimit = 2;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
}); Now the redirect URI generation works as expected. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm running an ASP.NET Core app behind two proxies:
Internet ---> Load Balancer ---> OpenShift Ingress ---> My ASP.NET Core Application
Inspecting the
X-Forwarded-Host
-Header shows that both addresses are preserved in the header, e.g.,X-Forwarded-Host: example.com, internal-cluster-address.mycluster.com
. Logging theRequest.Host
Property shows that the right-most address was picked by theForwardedHeadersMiddleware
(internal-cluster-address.mycluster.com
). This is in line with the documentation: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-9.0#troubleshootThis is a problem, because
Request.Host
gets used during generation of Redirect-Uris while authenticating via OpenIdConnect and a cluster-internal address is obviously of no use to the users.How can I configure the middleware to use a specific value from the set of available
X-Forwarded-Host
Values?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions