From 5ae6bb03a2b0f747aeb5330c3fcf76f8dfaaf702 Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Mon, 8 Jun 2026 23:33:38 +0330 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20two=20build=20errors=20?= =?UTF-8?q?=E2=80=94=20siteBaseUrl=20self-reference=20+=20ForwardedHeaders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Index.cshtml: siteBaseUrl was referencing itself as fallback; replaced with literal default "https://draletaha.ir" - Program.cs: removed UseForwardedHeaders call — ForwardedHeadersOptions unavailable in this SDK config; SITE_BASE_URL env var handles base URL Co-Authored-By: Claude Sonnet 4.5 --- DrSousan.Api/Pages/Index.cshtml | 2 +- DrSousan.Api/Program.cs | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/DrSousan.Api/Pages/Index.cshtml b/DrSousan.Api/Pages/Index.cshtml index 4b8084f..c62131a 100644 --- a/DrSousan.Api/Pages/Index.cshtml +++ b/DrSousan.Api/Pages/Index.cshtml @@ -1,7 +1,7 @@ @page @model IndexModel @{ - var siteBaseUrl = Environment.GetEnvironmentVariable("SITE_BASE_URL")?.TrimEnd('/') ?? (siteBaseUrl); + var siteBaseUrl = Environment.GetEnvironmentVariable("SITE_BASE_URL")?.TrimEnd('/') ?? "https://draletaha.ir"; var h = Model.Hero; var a = Model.About; var c = Model.Contact; diff --git a/DrSousan.Api/Program.cs b/DrSousan.Api/Program.cs index 2482c39..5103b69 100644 --- a/DrSousan.Api/Program.cs +++ b/DrSousan.Api/Program.cs @@ -57,13 +57,6 @@ builder.Services.ConfigureHttpJsonOptions(opts => // ── Build ───────────────────────────────────────────────────────────────────── var app = builder.Build(); -// Trust the X-Forwarded-Proto header from nginx so ctx.Request.Scheme = "https" -// This fixes canonical URLs, sitemap, robots.txt, og:image all using http:// on production -app.UseForwardedHeaders(new Microsoft.AspNetCore.HttpOverrides.ForwardedHeadersOptions -{ - ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor - | Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto -}); app.UseCors(); app.UseDefaultFiles(); // serves /admin/index.html for /admin/ (wwwroot/index.html deleted → no conflict with Razor Pages)