Fase B1: Website:Mode via configuratie (ASF kiest in appsettings), Api = alle-modules-compositie; flaky SMTP-test gerepareerd
- CmsHostOptions.ResolveWebsiteMode: Website:Mode wint van de code, default SpaFallback, onbekende waarde stopt de host. - ASF: Website:Mode=PrerenderedPages in appsettings.json, Program.cs zonder eigen modus. - SlpModularCms.Api verwijst nu ook naar Offerings en Contact met generieke default-config (Website/Email/App/Contact/RateLimiting). - SmtpFailureTests: '535' als los getal, niet als substring van een willekeurige poort. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,8 @@ public static class CmsHost
|
||||
builder.Services.AddCmsSecurityHeaders(builder.Configuration);
|
||||
builder.Services.AddCmsObservability(builder.Configuration);
|
||||
|
||||
if (options.WebsiteMode == WebsiteMode.PrerenderedPages)
|
||||
var websiteMode = options.ResolveWebsiteMode(builder.Configuration);
|
||||
if (websiteMode == WebsiteMode.PrerenderedPages)
|
||||
{
|
||||
builder.Services.AddCmsWebsite(builder.Configuration);
|
||||
}
|
||||
@@ -96,6 +97,7 @@ public static class CmsHost
|
||||
/// </summary>
|
||||
public static void ConfigurePipeline(WebApplication app, ModuleOrchestrator orchestrator, CmsHostOptions options)
|
||||
{
|
||||
var websiteMode = options.ResolveWebsiteMode(app.Configuration);
|
||||
// Bring the Core schema up to date before serving any traffic. Runs before the module
|
||||
// middleware below, because the Data Protection keys table lives in this context and the
|
||||
// modules resolve an IDataProtector as soon as they start. Fails fast: a host that cannot
|
||||
@@ -121,7 +123,7 @@ public static class CmsHost
|
||||
|
||||
// SpaFallback sites: X-Robots-Tag on test hosts and generated robots.txt / sitemap.xml. After the
|
||||
// security headers (so these answers carry them) and before the static files short-circuit.
|
||||
if (options.WebsiteMode == WebsiteMode.SpaFallback)
|
||||
if (websiteMode == WebsiteMode.SpaFallback)
|
||||
{
|
||||
app.UseCmsSpaSeo();
|
||||
}
|
||||
@@ -142,12 +144,12 @@ public static class CmsHost
|
||||
// wwwroot/admin/index.html + assets -> CMS admin build (see frontend/, copied in on publish)
|
||||
// Registered before the module middleware below: static files short-circuit the pipeline, so
|
||||
// anything that must observe them has to come first.
|
||||
app.UseCmsStaticContent(options.WebsiteMode);
|
||||
app.UseCmsStaticContent(websiteMode);
|
||||
|
||||
// WebsiteMode.PrerenderedPages: the website replaces the SPA-style website mount, at the same
|
||||
// position and for the same reason (it answers before the module middleware and the API).
|
||||
// It never handles /admin, /api/v1 or /health.
|
||||
if (options.WebsiteMode == WebsiteMode.PrerenderedPages)
|
||||
if (websiteMode == WebsiteMode.PrerenderedPages)
|
||||
{
|
||||
app.UseCmsPrerenderedSite();
|
||||
}
|
||||
@@ -177,11 +179,11 @@ public static class CmsHost
|
||||
|
||||
// SPA fallbacks so client-side routes (e.g. /admin/dashboard) resolve to the right index.html
|
||||
// instead of 404ing. The "nonfile" constraint keeps genuinely missing assets (e.g. /admin/assets/x.js) as 404s.
|
||||
app.MapCmsSpaFallbacks(options.WebsiteMode);
|
||||
app.MapCmsSpaFallbacks(websiteMode);
|
||||
|
||||
// WebsiteMode.PrerenderedPages: lowest-priority endpoint, so unknown website paths get
|
||||
// 404.html with status 404 only AFTER every API route and the admin fallback had their turn.
|
||||
if (options.WebsiteMode == WebsiteMode.PrerenderedPages)
|
||||
if (websiteMode == WebsiteMode.PrerenderedPages)
|
||||
{
|
||||
app.MapCmsWebsiteNotFound();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user