Force request host/scheme to App__Domain behind a proxy
The cookie login redirect and other absolute URLs are built from Request.Host; behind a proxy that doesn't forward the Host header that's the internal IP:port, so hitting the domain 302'd to the server IP. Rewrite scheme+host to App__Domain on every request (after UseForwardedHeaders) so all generated URLs stay on the public domain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,4 +26,11 @@ public class AppDomainOptions
|
||||
|
||||
return domain + "/" + path.TrimStart('/');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The configured domain as an absolute base <see cref="Uri"/> (scheme + host [+ port]), or
|
||||
/// <c>null</c> when no domain is set or it can't be parsed.
|
||||
/// </summary>
|
||||
public Uri? GetBaseUri() =>
|
||||
BuildUrl("/") is { } url && Uri.TryCreate(url, UriKind.Absolute, out var uri) ? uri : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user