This commit is contained in:
2023-07-25 07:49:51 +03:00
parent 96eca795ab
commit ce2ae68c9f
22 changed files with 25 additions and 1453 deletions
+2 -15
View File
@@ -395,22 +395,9 @@ public class Program
private static string GetFrontendHost(HttpContext ctx, ILogger logger)
{
// get X-Forwarded-Proto when reversed proxy used
// internet <-> nginx (https) <-> site(http)
var host = $"{ctx.Request.Headers["X-Forwarded-Proto"]}";
host = host.IsMissing()
? ctx.Request.IsHttps ? "https" : "http"
: host!;
host += $"://{ctx.Request.Host.Value}";
logger.LogCritical($"FR Host: {host}");
if (host.Contains(":4300"))
{
logger.LogCritical(ctx.Request.Path);
logger.LogCritical(string.Join('|', ctx.Request.Headers.Select(x => $"{x.Key}={x.Value}")));
}
var host = $"{ctx.Request.Headers["Referer"]}";
host = host.EndsWith("/") ? host.Substring(0, host.Length - 1) : host;
return host;
}