Deployment Configuration and Script

- Front End Cleanup
This commit is contained in:
daniel-c-harvey
2025-09-06 18:40:32 -04:00
parent 0951514778
commit a5b7ab041e
13 changed files with 169 additions and 21 deletions
+20 -4
View File
@@ -30,10 +30,26 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<Folder Include="wwwroot\js\" />
<Content Update="Interop\webaudio.js">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="Interop\webaudio.ts">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</TypeScriptCompile>
</ItemGroup>
<!-- Prevent TypeScript compilation issues during publish -->
<PropertyGroup>
<TypeScriptCompileOnSaveEnabled>false</TypeScriptCompileOnSaveEnabled>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
</PropertyGroup>
<!-- Only copy tsconfig.json to root output, not nested publish folders -->
<ItemGroup>
<None Update="tsconfig.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
+20 -1
View File
@@ -2,6 +2,7 @@ using DeepDrftWeb;
using DeepDrftWeb.Client.Services;
using MudBlazor.Services;
using DeepDrftWeb.Components;
using Microsoft.AspNetCore.HttpOverrides;
var builder = WebApplication.CreateBuilder(args);
@@ -27,9 +28,21 @@ builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
// Configure forwarded headers for reverse proxy support
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
// Trust any proxy (nginx) - in production, specify known proxy networks
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
var app = builder.Build();
// Configure the HTTP request pipeline.
// Use forwarded headers before other middleware
app.UseForwardedHeaders();
if (app.Environment.IsDevelopment())
{
app.UseWebAssemblyDebugging();
@@ -39,7 +52,13 @@ else
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
app.UseHttpsRedirection();
// Only use HTTPS redirection if not behind a reverse proxy
var disableHttpsRedirection = app.Configuration.GetValue<bool>("ForwardedHeaders:DisableHttpsRedirection");
if (!disableHttpsRedirection)
{
app.UseHttpsRedirection();
}
}
app.UseAntiforgery();
+4 -1
View File
@@ -5,5 +5,8 @@
"Microsoft.AspNetCore": "Warning"
}
},
"DetailedErrors": true
"DetailedErrors": true,
"ApiUrls": {
"ContentApi": "https://localhost:54493/api"
}
}
+4 -1
View File
@@ -10,6 +10,9 @@
"DefaultConnection": "Data Source=../Database/deepdrft.db"
},
"ApiUrls": {
"ContentApi": "https://localhost:54493"
"ContentApi": "https://localhost:12777/api"
},
"ForwardedHeaders": {
"DisableHttpsRedirection": "true"
}
}
+4 -2
View File
@@ -10,9 +10,11 @@
"outDir": "wwwroot/js"
},
"include": [
"Interop/**/*"
"**/*.ts"
],
"exclude": [
"node_modules"
"node_modules",
"bin/**/*",
"obj/**/*"
]
}