Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions EssentialCSharp.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ await context.HttpContext.Response.WriteAsync(
? configuredBaseUri.Host[4..]
: configuredBaseUri.Host;
string wwwHost = $"www.{apexHost}";
string redirectAuthority = new UriBuilder(configuredBaseUri) { Host = apexHost }.Uri.GetLeftPart(UriPartial.Authority);

app.UseExceptionHandler(exceptionApp =>
{
Expand Down Expand Up @@ -525,8 +524,9 @@ await McpJsonRpcResponseWriter.WriteErrorAsync(
{
if (string.Equals(context.Request.Host.Host, wwwHost, StringComparison.OrdinalIgnoreCase))
{
string redirectUrl = $"{redirectAuthority}{context.Request.PathBase}{context.Request.Path}{context.Request.QueryString}";
context.Response.Redirect(redirectUrl, permanent: true);
PathString redirectPath = context.Request.PathBase.Add(context.Request.Path);
string redirectTarget = $"{redirectPath}{context.Request.QueryString}";
context.Response.Redirect(redirectTarget, permanent: true);
Comment thread
BenjaminMichaelis marked this conversation as resolved.
Outdated
return;
}
await next(context);
Expand Down
Loading